How to change "niceness" while perfoming top command?

I know that I can change the niceness using this command:

renice [-n] priority [[-p] pid ...] [[-g] pgrp ...] [[-u] user ...]

But it would be much more convenient if I could do it while scanning the processes in top.


Solution 1:

Press r. That's it! :-)

Reference: The 9th item in 12 TOP Command Examples in Linux

Solution 2:

htop gives you a user interface, that is easier to use. F7 and F8 are used to renice the high-lighted process. You need sudo permissions to decrease the nice value.

sudo add-apt-repository universe  # only for standard Ubuntu
sudo apt update
sudo apt install htop

htop

Or if you want to decrease the nice value (can be dangerous)

sudo -H htop