nice and renice adjust CPU scheduling niceness (−20 to 19). ionice is separate: it classes disk I/O (realtime, best-effort, idle) so a backup does not starve a database on the same disk — a common comparison search on busy VPS hosts.
Related: kill & pkill,
htop,
iostat & vmstat.
nice — start a job softer
Lower priority before the process runs — good for cron backups and reindex jobs.
nice -n 19 tar -czf /backup/site.tgz /var/www

renice — running processes
Tune an already-hot PID when killing is too drastic; non-root users can only raise niceness (lower priority).
renice +10 -p 18432
ps -o pid,ni,cmd -p 18432

ionice — disk friendly
Class 3 (idle) I/O runs only when the disk is otherwise idle — pair with nice for heavy rsync.
ionice -c3 nice -n 19 rsync -a /data/ /mnt/backup/

nice vs ionice vs cgroups
Nice does not fix I/O saturation; ionice does not fix CPU-bound loops. For containers, also tune cpu.weight / IO limits.
nice -n -20 on shared systems can violate fair-use policy.
Quick Reference
- New job:
nice -n 19 command - Running:
renice +n -p PID - Disk:
ionice -c3 command
Related tutorials
Diagrams are original illustrations by Gnome IT Solutions. Tutorial text © Gnome IT Solutions.