Using renice to change the priority of a process

In the post "Using nice" we saw how we can assign a custom nice number to a process while launching it.
If we want to change the nice number of a process that is already running, then we can use the command renice.
The syntax of renice is

To find the pid of a process we can use the command pidof.
For example if we are running the gedit editor and want to get the pidof gedit, we can use

This pid can be used with the command renice. But before renice we can find the command currnet nice value of process by using the ps command

We can see that the current noice number of gedit is "-1". To change it to -5 we can use renice.

If we run ps now , we will notice the change in the nice number of the process.

The other options of the renice are explained in the man pages.

No comments:

Post a Comment

Follow by Email