This post lists the classic, traditional commands, as well as some more useful, modern ones.
Other programs, like htop, provide a friendly interface on top of the commands.
Top displays a list of processes, with the ones using the most CPU at the top.
To exit top or htop, use theCtrl-Ckeyboard shortcut.
This keyboard shortcut usually kills the currently running process in the terminal.
htop
Thehtopcommand is an improved top.
We’vecovered htop in more detailin the past.
ps
Thepscommand lists running processes.
You could also pipe the output throughgrepto search for a specific process without using any other commands.
It displays them in tree format.
kill
Thekillcommand can kill a process, given its process ID.
you’re able to get this information from theps -A,toporpgrepcommands.
kill PID
Technically speaking, the kill command can send any signal to a process.
it’s possible for you to usekill -KILLorkill -9instead to kill a stubborn process.
pgrep
Given a search term,pgrepreturns the process IDs that match it.
Using pkill or killall is simpler, though.
pkill & killall
Thepkillandkillallcommands can kill a process, given its name.
Use either command to kill Firefox:
pkill firefox
killall firefox
We’vecovered pkillin more depth in the past.
renice
Therenicecommand changes the nice value of an already running process.
The nice value determines what priority the process runs with.
A value of-19is very high priority, while a value of19is very low priority.
A value of0is the default priority.
The renice command requires a process’s PID.
If you’re making a process run at a higher priority, you’ll require root permissions.
Run it and your cursor will turn into anxsign.
Click a program’s window to kill that program.
We’ve coveredbinding xkill to a hotkeyto easily kill processes.