The renice command is used to change the nice level of an existing process. Its syntax is as follows:
$ renice -n <NICELEVEL> <PID’s>
In the following screenshot, a standard user is trying to increase the priority of a process by assigning a negative value, hence they are getting Permission denied, as shown in the following screenshot:
Now, when a standard user lowers the priority of a process by assigning a positive value, it is set immediately, as shown in the following screenshot:
Apart from the renice command, the top command can also be used to modify the nice value of a running process. The following steps are used to modify a process priority using the top command:
- Invoke the top command
- Press r key on the keyboard to bring up the option for specifying a new nice value on the top command's current interactive session
- Enter the new nice value and PID, followed by pressing the Enter key