MYSYSAD.COM

Modify a Command's Scheduling Priority with nice

· Shell & text · System & processes

There may be times when you need to modify the priority of a command prior to starting it. You can do this by using the nice command. It modifies the scheduling priority of the command . 19 is the lowest priority, 1 is the highest priority, and 10 is the default. Here are a few examples.

Highest priority
# nice -n 1 myfind &
returns PID

Lowest priority
# nice -n 19 myfind &
returns PID

Default priority is 10

Also, the renice command can be used to change the priority of a job.

# renice -18 PID

stephane added the priorities range from -20 (or -19 depending on the Unix) to 19, -20/-19 being the most favorable scheduling, 19 the least favorable one. The negative increments are allowed only for root.

So if you are root, you can do this : nice -19 myfind

to get it running with max priority.