Linux nice command: Run Process With Modified Scheduling Priority ( nicenesses )

by on November 16, 2007 · 10 comments· LAST UPDATED February 26, 2008

in , ,

Q. How do I run a process with modified scheduling priority under Linux? I'd like to change the priority in the kernel's scheduler while starting a command.

A. Use nice command to run a program with modified scheduling priority / nicenesses. Nicenesses range at least from -20 (resulting in the most favorable scheduling) through 19 (the least favorable). The default behavior is to increase the niceness by 10.

A niceness should not be confused with a scheduling priority, which lets applications determine the order in which threads are scheduled to run. Unlike a priority, a niceness is merely advice to the scheduler, which the scheduler is free to ignore.

nice syntax (/bin/nice command)

/bin/nice -n NUM

Add integer NUM (-20 to 19) to the niceness.

WARNING! There are multiple versions of the nice command. One built in to the shell, and one in /bin/nice. The syntax may be diffrent on your system. Refer your shell and /bin/nice command man page for details.

Change niceness by 3

Type the command as follows:
$ /bin/nice -n 3 command-name

Only a privileged user may run a process with lower niceness:
$ /bin/nice -n -1 command-name

Shell in build nice command syntax

If you use the csh or tcsh or bash, the syntax is as follows:
nice +n command
I recommend using /bin/nice syntax to avoid confusion and to save time.

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 10 comments… read them below or add one }

1 Sekhar November 10, 2009 at 9:44 am

Can you specify one example fo nice command to run in redhat


2 rinshad January 21, 2011 at 11:17 am

nice is really nice !!


3 wow February 14, 2011 at 2:41 am

what a douche comment.


4 DaVince October 24, 2014 at 5:50 pm

No, your comment is douche. Rinshad’s is just silly.


5 Tweeks October 28, 2014 at 5:30 pm

Seriously guys.. I’ve never had nice do much for my system scheduler/load wise. ionice seems to have a bit more impact for the ioscheduler.. but have you all ever really seen that much of an improvement on CPU bound processes and using nice on Linux?



6 anon June 6, 2011 at 4:51 pm

There’s also the renice command (from bsdutils on Debian-like distros), which is potentially less confusing.


7 nn May 4, 2012 at 9:27 am

Plz give clear explanation of nice command along with example


8 Vinay Kudithipudi May 17, 2012 at 2:08 pm

A good example for using nice would be to use it when taring up a huge directory. If you think that is going to impact your IO and other applications running on the server, you can use nice as such

nice -n 3 tar -cvf test.tar test_dir/*


9 Thomas Weeks April 29, 2013 at 9:31 pm

Does nice actually work? I’ve never seen much of a scheduling/priority/load change from nicing CPU hungry tasks. I have, however, heard good things about ionice for tweaking io-heavy apps. Maybe you should both nice and ionice a process that is going to hammer the CPU and IO.



10 Mike July 11, 2013 at 6:11 pm

So these are both valid?

nice -20 yum update
nice -n -20 yum update


Leave a Comment

Tagged as: , , , , , , , ,

Previous Faq:

Next Faq: