brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: renice -n 10 -p PID makes a running process less greedy

Linux
~/tips/tip-renice-running-process

renice -n 10 -p 4242

Lower the priority of a job that is already running, without restarting it.

nice is fine when you start a heavy job, but sometimes I only notice a job is hogging the CPU once it already runs. Killing it and starting again would lose the work.

renice changes the nice value of a process that is already running:

renice -n 10 -p 4242

The output says old priority 0, new priority 10. A higher nice value means a lower urgency, so other processes get the CPU first. You can also target a whole user with -u or a process group with -g; the default is a PID.

A caveat: only the superuser can lower a nice value again. Other users may only change processes they own, and only towards a higher value, so renice a job to 10 and you can’t give it back its old priority without sudo. Pick a modest number first.

Further reading: renice(1) man page

More Linux tips a2query -m rewrite cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt flatpak uninstall --unused All Linux tips (261) All topics

Link