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 parted Command: Inspect and Manage Partitions

Linux parted Command: Inspect and Manage Partitions

Learn how to inspect and Manage Partitions with the Linux parted command, including practical examples, key options, and important precautions.

Linux whereis Command: Locate Binaries, Source, and Man Pages

Linux whereis Command: Locate Binaries, Source, and Man Pages

Learn how Linux whereis locates binaries, source files, and manual pages, limits each search type, lists effective paths, and differs from which and find.

Linux Tutorial / Compare Files with diff and cmp

Linux Tutorial / Compare Files with diff and cmp

Use diff and cmp to compare two files, read unified diff output, and distinguish a detected difference from an actual command error.

Linux bg Command: Resume a Shell Job in the Background

Linux bg Command: Resume a Shell Job in the Background

Learn how to resume a Shell Job in the Background with the Linux bg command, including practical examples, key options, and important precautions.

Linux printf Command: Print Values with a Defined Format

Linux printf Command: Print Values with a Defined Format

Learn how to print Values with a Defined Format with the Linux printf command, including practical examples, key options, and important precautions.

Linux dd Command: Copy and Convert Data by Blocks

Linux dd Command: Copy and Convert Data by Blocks

Learn how to copy and convert files or block devices with Linux dd, choose block sizes and ranges, display progress, verify results, and avoid overwriting the wrong device.

Linux shred Command: Overwrite File Data and Understand Its Limits

Linux shred Command: Overwrite File Data and Understand Its Limits

Learn how Linux shred overwrites file data, which options control its passes and removal, and why SSDs, snapshots, backups, and modern filesystems limit its guarantees.

Linux command Command: Run Commands While Bypassing Aliases and Functions

Linux command Command: Run Commands While Bypassing Aliases and Functions

Learn how to use the Linux command command to check command availability and bypass shell aliases or functions, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux ip Command: Inspect and Configure Network Interfaces and Routes

Linux ip Command: Inspect and Configure Network Interfaces and Routes

Learn how to inspect and Configure Network Interfaces and Routes with the Linux ip command, including practical examples, key options, and important precautions.

Linux fsck Command: Check and Repair Filesystems

Linux fsck Command: Check and Repair Filesystems

Learn how to check and Repair Filesystems with the Linux fsck command, including practical examples, key options, and important precautions.