Linux renice Command: Change the Priority of a Running Process

renice changes the nice value of a process that is already running. When batch jobs use a lot of CPU and affect other tasks, you can check the target PID and adjust it accordingly.

What is the renice command?

The larger the nice value, the lower the CPU priority generally is. This command only relates to CPU scheduling and does not reduce memory usage or the process itself. Lowering the value to increase priority may require administrator privileges or special limits.

Basic syntax

renice -n priority -p PID...

The installed implementation and options may vary depending on the distribution. Check your current system's description with man renice.

Examples

Checking the current nice value

First, confirm that the target PID and command are correct.

ps -p 1234 -o pid,user,ni,cmd

Adjusting a running process

Set the nice value of the current process to 10.

renice -n 10 -p 1234

Check the results again

Check the actual NI column after the change.

ps -p 1234 -o pid,ni,cmd

Check the value change of a running process

renice changes the nice value of an already running process. Replace PID with the actual PID of the test process, and check before and after the change using ps.

ps -o pid,ni,comm -p PID
renice -n 10 -p PID
ps -o pid,ni,comm -p PID

For example, the NI column in the last check changes from 0 to 10. The message format of renice itself may vary depending on the implementation.

Lowering the value to increase priority usually requires additional privileges. Even if the value is changed to address CPU issues, you should also check for bottlenecks or disk/memory wait times. Make sure to verify the target information right before execution to avoid acting on a PID that has already ended or been reused.

Main Options and Format

Options/Format Description
-n value Specify the nice priority to set.
-p PID Select the target by process ID.
-u user Select processes that belong to the user. The range is wide, so caution is needed.
-g group Select the process group as the target.

Precautions when using

Since PIDs can be reused, check the command and owner again with ps just before adjusting. renice -u can affect multiple processes of the user. Lowering the nice value requires permission, and even if the adjustment is successful, other CPU resource limits or cgroup policies may take priority.

Frequently Asked Questions

What is the difference between nice and renice?

nice adjusts the priority when starting a new command, while renice changes the nice value of a process that is already running.

Official Documentation

You can check the exact behavior of the options and implementation-specific differences in the official documentation about renice.

More in This Category
Linux umount Command: Unmount a Filesystem Safely

Linux umount Command: Unmount a Filesystem Safely

Learn how to unmount a Filesystem Safely with the Linux umount command, including practical examples, key options, and important precautions.

Linux pgrep Command: Find Process IDs by Name or Criteria

Linux pgrep Command: Find Process IDs by Name or Criteria

Learn how to find Process IDs by Name or Criteria with the Linux pgrep command, including practical examples, key options, and important precautions.

Linux which Command: Find Executables in PATH

Linux which Command: Find Executables in PATH

Learn how Linux which searches PATH for executables, shows all matching paths, differs from type and command -v, and should be used carefully in scripts.

Linux Tutorial / Understand Users, Groups, and File Ownership

Linux Tutorial / Understand Users, Groups, and File Ownership

Understand UIDs, GIDs, primary and supplementary groups, and file ownership, then inspect them safely with id, groups, getent, ls, and stat.

Linux traceroute Command: Trace Routers on the Way to a Host

Linux traceroute Command: Trace Routers on the Way to a Host

Learn how to trace Routers on the Way to a Host with the Linux traceroute command, including practical examples, key options, and important precautions.

Linux tr Command: Translate and Delete Characters

Linux tr Command: Translate and Delete Characters

Learn how to translate and Delete Characters with the Linux tr command, including practical examples, key options, and important precautions.

Linux locate Command: Search Indexed File Paths Quickly

Linux locate Command: Search Indexed File Paths Quickly

Learn how Linux locate searches a filename database, how updatedb affects freshness, how to limit and filter matches, and when find is the better tool.

Linux watch Command: Run a Command Repeatedly

Linux watch Command: Run a Command Repeatedly

Learn how to use the Linux watch command to rerun a command at regular intervals and highlight changing output, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux zip Command: Create ZIP Archives

Linux zip Command: Create ZIP Archives

Learn how to create ZIP Archives with the Linux zip command, including practical examples, key options, and important precautions.

Linux Tutorial / Install and Update Packages with APT and DNF

Linux Tutorial / Install and Update Packages with APT and DNF

Compare APT on Debian or Ubuntu with DNF on Rocky Linux for searching, installing, updating, and removing packages, including repository and transaction checks.