Managing Process Priority on Linux with nice and renice

Linux lets you influence how the scheduler prioritizes competing processes via “niceness” — a genuinely useful tool for keeping a background job from starving interactive work of CPU time.

# Start a process with lower priority (higher nice value = LOWER priority)
nice -n 15 tar -czf backup.tar.gz /data

# Change the priority of an ALREADY RUNNING process
renice -n 10 -p 12345

# Nice values range from -20 (highest priority) to 19 (lowest)
# Only root can set NEGATIVE nice values (increase priority above normal)
sudo nice -n -5 important-process

A Practical Pattern: ionice for Disk I/O

# Similarly deprioritize a process's DISK I/O, not just CPU
ionice -c 3 rsync -av /data /backup   # class 3 = idle, only uses disk when nothing else needs it

A backup or batch job niced down (both CPU and I/O) runs happily in the background without noticeably impacting a server’s interactive or production workloads — a simple, underused technique for running maintenance work alongside live traffic.