renice Command in Linux with Examples

This tutorial explains Linux “renice” command, options and its usage with examples.

renice – alter priority of running processes.

DESCRIPTION

Every running process in Unix has a priority assigned to it.

You can change the process priority using nice and renice utility. Nice command will launch a process with an user defined scheduling priority. Renice alters the scheduling priority of one or more running processes. The following who parameters are interpreted as process ID’s, process group ID’s, or user names. Renice ‘ing a process group causes all processes in the process group to have their scheduling priority altered. Renice ‘ing a user causes all processes owned by the user to have their scheduling priority altered. By default, the processes to be affected are specified by their process ID’s.

SYNOPSIS

renice priority [ -n Increment ][[-p ] pid … ] [[-g ] pgrp … ] [[-u ] user … ]

advertisement
advertisement

OPTIONS :

-n Increment
Specifies the number to add to the nice value of the process. The value of Increment can only be a decimal integer from -20 to 20. Positive increment values cause a lower nice value. Negative increment values require appropriate privileges and cause a higher nice value.
-g
Force who parameters to be interpreted as process group ID’s.
-u
Force the who parameters to be interpreted as user names.
-p
Resets the who interpretation to be (the default) process ID’s.

EXAMPLES

1. The following will change nice value of process 2243 to 19

Note: Join free Sanfoundry classes at Telegram or Youtube
# renice 19 2243

2. This would change the priority of process ID’s 987 and 32, and all processes owned by users daemon and root

# renice +1 987 -u daemon root -p 32

Note: The specified Increment changes the priority of a process in the following ways:

advertisement

1 to 20 :- Runs the specified processes slower than the base priority.
0 :- Sets priority of the specified processes to the base scheduling priority.
-20 to -1 :- Runs the specified processes quicker than the base priority.

3. To alter the system scheduling priority so that group IDs 324 and 76 have higher scheduling priorities (if the user has the appropriate privileges to do so), enter:

# renice -n -4 -g 324 76

Note:
(1) Users can only change the nice value of processes which they own.
(2) User cannot start processes with nice values less than 20.
(3) User cannot lower the nice values of their processes after they’ve raised them.
(4) As usual root has full access to renice command.

advertisement

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.