nice: start a command with specified priority
Runs a command with a specified priority
Typical usage: automation tasks, shell scripting, system administrationIntroduction into nice
The nice tool can be used on Linux to start commands with a specified priority. This is useful to start tasks that may need to run for a while but at a low priority, to reduce the impact on the system or its performance.
Installation
When nice is not installed by default, it can be added to the system using the relevant software package.
Package information for nice
Operating system | Package name | Installation |
---|---|---|
AlmaLinux | coreutils |
|
Arch Linux | coreutils |
|
Debian | coreutils |
|
Fedora | coreutils |
|
Red Hat Enterprise Linux | coreutils |
|
Rocky Linux | coreutils |
|
openSUSE | coreutils |
|
Ubuntu | coreutils |
|
Your Linux distribution using a different package? Share your feedback.
Usage
Available options
Long option | Short option | Description |
---|---|---|
--adjustment | -n | Sets priority (-20 is highest, 19 lowest) |
Missing an option in this overview? Share your feedback.
Examples using nice
Runs the nice command with priority 15, then shows the priority
nice -n 15 nice
Output: 15
Runs a script with lowest priority
nice --adjustment=19 /mnt/scripts/lowest-priority-script
Frequently Asked Questions
What is the nice command and its purpose?
The nice command is a command-line tool to run commands with a specified priority.
Which package provides the nice command?
The command nice is provided by the coreutils package.
Relevant articles using the nice command
The following articles include an example on how to use nice and might be worth further exploring.
Related and similar commands
Linux has a lot of tools and commands available and sometimes you just need that little other tool. Here is a list of commands that are similar or related to nice:
Command | Category | Summary |
---|---|---|
basename | files | Strips directory and file name suffix from a given path |
chrt | processes | Sets Linux scheduler policy and priority for a process or command |
kill | processes | Sending signals to processes |
numactl | processes | Controls NUMA policy for processes and shared memory |
peekfd | processes | Tracks a process and show file descriptor activity |
pidof | processes | Returns process IDs for a process name |
pidstat | monitoring | Monitoring CPU, memory, and disk activity |
pidwait | processes | Wait for process to stop |
pmap | processes | Shows memory mapping of process |
prtstat | processes | Shows process details for selected process like state, CPU and memory usage |
pscap | capabilities | Display available capabilities for running processes |
pslog | logging | Shows which log files a process has opened |
pstree | processes | Show active processes and children like a tree |
pwdx | processes | Shows current working directory of a process |
renice | processes | Changes the priority of running processes |
rev | data | Shows text in reverse order |
slabtop | memory | Shows slab usage of kernel |
smem | memory | Show memory usage including swap |
strace | process inspection | Inspects running process |
units | data conversion | Converts a unit into another one, like from Celcius to Fahrenheit |
watch | processes | Monitors changes in output of specified command |