renice

Change The Priority of a Running Process in Linux with renice

The renice command lets you set give or take priority of processes according to level of importance. If there is contention for resources on your server, the kernel will automatically prioritize resource allocation according to how you set it.

The nice value (NI column in htop) defaults to 0. A setting of "-20" gives the proces top priority, while a setting of "20" gives it the lowest. Basically lower the value, higher the priority and it can be set to any number between -20 and 20.

The syntax is pretty simple.

Lower Process PID 50777 Priority by 20

renice -n 20 -p 50777

You will see output like this:

50777: old priority 0, new priority 19

Raise Process PID 50777 to -20

renice -n -20 -p 50777

You will see output like this:

50777: old priority 19, new priority -20

Lower Priority of all Processes Run by apache user

renice -n 10 -u apache

You will see output like this:

48: old priority 0, new priority 10
(Comments)

Comments