What is the usage of the Linux nice command?

The nice command is used to change the priority of a process, allowing it to be adjusted to a lower priority level to reduce its consumption of system resources. By using the nice command, the system can become more stable and avoid instances of high system load.

The specific usage is:

nice [OPTION] [COMMAND [ARG]...]

Among them, OPTION can be one of the following options:

  1. -n: specifies the priority value for the process to adjust, with a range of -20 to 19, where a lower value indicates a higher priority. The default value is 10.
  2. -p: Displays the priority of the specified process.
  3. -q: Change the priority value of the process.

For example, to set the priority of a process to 5, you can use the following command:

nice -n 5 [COMMAND]

To view the priority of a specified process, you can use the following command:

nice -p [PID]
Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds