• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

renice Command Examples in Linux

by admin

When we work with the nice command, it’s clear that it can’t change the scheduling priority of running processes. As we’ve just seen, we would need to stop and then start the process in this case. This is where the renice command shines. We can leverage the renice command to change the niceness while the process is running. To see the syntax, we would pass the –help option:

# renice --help
Usage:
 renice [-n]  [-p|--pid] ...
renice [-n]   -g|--pgrp ...
 renice [-n]   -u|--user ...
Alter the priority of running processes.
Options:
 -n, --priority    specify the nice increment value
 -p, --pid          interpret argument as process ID (default)
 -g, --pgrp         interpret argument as process group ID
 -u, --user | interpret argument as username or user ID
 -h, --help     display this help and exit
 -V, --version  output version information and exit

renice command may be applied to a process, process group, or user (target). A privileged user may alter the priority of other users’ processes. priority must, for ordinary users, lie between 0 and the environment variable PRIO_MAX (normally 20), with a higher number indicating increased niceness. A higher niceness value means that the process will run at a lower priority. A privileged user may set a negative priority, as low as PRIO_MIN (normally −20), to speed up processes. See the nice command for setting the scheduling priority for processes when they are initially run.

renice Command Examples

1. To set the priority for process:

# renice -n 20 -p 2112
# renice --priority 20 -p 2112 

2. To change the priority for process os a group:

# renice -n 20 -g SUPPORT 

3. To change the priority for process os a user:

# renice -n 20 u mike 

4. To get the version:

# renice -v
# renice --version 

5. To get the help:

# renice -h
# renice --help 

6. Change priority of all processes owned by a user:

# renice -n niceness_value -u user

7. Change priority of all processes that belong to a process group:

# renice -n niceness_value --pgrp process_group

Conclusion

The renice command is used to change the nice level of an existing process. Its syntax is as follows:

$ renice -n [NICELEVEL] [PID’s]

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.

Filed Under: Linux

Some more articles you might also be interested in …

  1. pvs: command not found
  2. gitlab-runner Command Examples
  3. bat: command not found
  4. How to uninstall cmake package from Ubuntu
  5. “git status” Command Examples
  6. nping: command not found
  7. “git ls-tree” Command Examples
  8. chromium: Open-source web browser principally developed and maintained by Google
  9. jpegtran for image optimization
  10. f3probe: Probe a block device (e.g. a flash drive or a microSD card) for counterfeit flash memory

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright