YouTip LogoYouTip

Linux Comm Nice

# Linux nice Command [![Image 3: Linux Command Manual](#) Linux Command Manual](#) The Linux nice command executes a program with a modified scheduling priority. If no program is specified, it prints the current scheduling priority. The default adjustment is 10, with a range from -20 (highest priority) to 19 (lowest priority). Usage permissions: All users. ### Syntax nice [command [arg...]] **Parameter Description**: * -n adjustment, -adjustment, --adjustment=adjustment all increase the original priority by adjustment. * --help displays help information. * --version displays version information. ### Examples Set the priority of a running program # vi & //Run in background 15297# nice vi & //Set default priority 15298+ Stopped vi # nice -n 19 vi & //Set priority to 19 15299+ Stopped nice vi # nice -n -20 vi & //Set priority to -20 15300+ Stopped nice -n 19 vi # ps -l //Display processes F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 4 S 0 15278 15212 0 80 0 - 1208 wait pts/2 00:00:00 bash 0 T 0 15297 15278 0 80 0 - 2687 signal pts/2 00:00:00 vi 0 T 0 15298 15278 0 90 10 - 2687 signal pts/2 00:00:00 vi 0 T 0 15299 15278 1 99 19 - 2687 signal pts/2 00:00:00 vi 4 T 0 15300 15278 3 60 -20 - 2687 signal pts/2 00:00:00 vi 4 R 0 15301 15278 0 80 0 - 625 - pts/2 00:00:00 ps + Stopped nice -n -20 vi Increase the priority of ls by 1 and execute it nice -n 1 ls Increase the priority of ls by 10 and execute it nice ls **Note:** Priority is a parameter used by the operating system to determine CPU allocation. Linux uses a "round-robin" algorithm for CPU scheduling. The higher the priority, the more CPU time the process is likely to receive. [![Image 4: Linux Command Manual](#) Linux Command Manual](#)
← Linux Comm ProcinfoLinux Comm Ps β†’