nice Command
Intermediate Process Management man(1)Run a command with modified scheduling priority
๐ 111 views
๐
Updated: Apr 29, 2026
SYNTAX
nice [OPTION]... COMMAND
What Does nice Do?
nice runs a command with a modified scheduling priority. The niceness value ranges from -20 (highest priority) to 19 (lowest priority). The default niceness is 0.
Higher niceness means the process is "nicer" to other processes โ it yields CPU time. Lower (negative) niceness means the process takes priority. Only root can set negative niceness values.
nice is essential for running CPU-intensive tasks without impacting system responsiveness. Use it for backups, compilations, batch processing, and any long-running task that should not starve other processes.
Higher niceness means the process is "nicer" to other processes โ it yields CPU time. Lower (negative) niceness means the process takes priority. Only root can set negative niceness values.
nice is essential for running CPU-intensive tasks without impacting system responsiveness. Use it for backups, compilations, batch processing, and any long-running task that should not starve other processes.
Options & Flags
| Option | Description | Example |
|---|---|---|
| -n | Set niceness adjustment value | nice -n 10 make -j4 |
| default | Without -n, uses niceness 10 | nice make |
| negative | Higher priority (root only) | sudo nice -n -5 critical-process |
| range | Values from -20 to 19 | nice -n 19 lowest-priority-task |
Practical Examples
#1 Run with low priority
Compiles code using all cores but at low priority so the system stays responsive.
$ nice -n 15 make -j$(nproc)#2 Default nice
Runs with niceness 10 (default nice increment).
$ nice tar czf backup.tar.gz /home/#3 Lowest priority
Runs cleanup at the lowest possible priority.
$ nice -n 19 find / -name "*.log" -mtime +30 -delete#4 High priority (root)
Starts a critical service with higher priority than normal processes.
$ sudo nice -n -10 critical-service#5 Background job with nice
Runs a backup sync in the background at lowest priority.
$ nice -n 19 rsync -av /data/ /backup/  Check current niceness
Shows the current niceness value of the shell.
$ niceTips & Best Practices
Always nice background jobs: Use nice -n 19 for backups, builds, and batch jobs. This prevents them from making the system sluggish for interactive users.
renice for running processes: nice sets priority at launch. To change priority of an already running process, use renice: renice -n 10 -p PID.
Negative values need root: Only root can set negative niceness (higher priority). Regular users can only increase niceness (lower priority).
Frequently Asked Questions
What niceness value should I use?
10-19 for background tasks (lower priority). 0 for normal tasks. Negative values (root only) for time-critical tasks. 19 is the safest for non-urgent work.
How do I change priority of a running process?
Use renice: renice -n 10 -p PID. Or from top/htop, press r and enter the new niceness value.
Does nice affect I/O priority too?
No, nice only affects CPU scheduling priority. For I/O priority, use ionice: ionice -c3 command runs with idle I/O priority.
Related Commands
More Process Management Commands
Download Process Management Cheat Sheet
View all 31 Linux command cheat sheets โMaster Linux with Professional eBooks
Curated IT eBooks covering Linux, DevOps, Cloud, and more
Browse Books โ