Linux Command: nice
Run a command with modified scheduling priority
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.
Syntax
nice [OPTION]... COMMANDCommon Examples
nice -n 15 make -j$(nproc)— Compiles code using all cores but at low priority so the system stays responsive.nice tar czf backup.tar.gz /home/— Runs with niceness 10 (default nice increment).nice -n 19 find / -name "*.log" -mtime +30 -delete— Runs cleanup at the lowest possible priority.sudo nice -n -10 critical-service— Starts a critical service with higher priority than normal processes.
Pro Tips
Master this and 230+ other Linux commands with our comprehensive eBooks and cheat sheets.
Related Resources