Show Running Processes in Linux terminal

The Linux terminal has a number of useful commands that can display running processes, kill them, and change their priority level.

The top command is classic way to view system’s resource usage and view processes that are taking up most system resources. Top displays a list of processes, with the ones using the most CPU at the top.

To exit top, use Ctrl-C keyboard shortcut.

The htop command is an improved top. It’s not installed by default so here is the command to install it on Debian (like Ubuntu / Raspbian):

sudo apt-get install htop

Or on Linux distribution using RPM

yum install htop

htop displays the same information as top with an improved layout. It also lets you select processes with the arrow keys and perform actions, such as killing them or changing their priority, with the F keys.

The ps command lists running processes.

sudo ps -A

Through grep to search for a specific process.

ps -A | grep firefox

The kill command can kill a process, given its process ID.

kill PID

killall and pkill
The pkill and killall commands can kill a process, given its name. Use either command to kill Firefox

pkill firefox
killall firefox

The renice command changes the nice value of an existing process. The nice value determines running priority of the process. A value of -19 is very high priority, while a value of 19 is very low priority. A value of 0 is the default priority.

The renice command requires a process’s PID. The following command makes a process run with very low priority:

renice 19 PID

Leave a Reply

Your email address will not be published.