Name
nice — stdin stdout - file -- opt --help --version
Synopsis
nice [-level]command_line
When invoking a system-intensive program, you can be nice to
the other processes (and users) by lowering its priority. That’s
what the nice command is for: it
sets a nice level (an amount of “niceness”)
for a process so it gets less attention from the Linux process
scheduler.[15] Here’s an example of setting a big job to run at nice
level 7:
$ nice −7 sort VeryLargeFile > outfile
If you run nice without a
level, 10 is used. Normal processes (run without nice) run at level zero, which you can see
by running nice with no
arguments:
$ nice 0
The superuser can also lower the nice level, increasing a process’s priority:
# nice --10 myprogram
(Yes, that’s “dash negative 10”.) To see the nice levels of your jobs, use ps and look at the “NI” column:
$ ps -o pid,user,args,nice
[15] This is called “nicing” the process. You’ll hear the term used as a verb: “That process was niced to 12.”
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access