Processes and signals: ps, top and kill
In short: Every running program is a process with a number (PID). With ps and top you see them, with signals you control or end them.
Viewing processes
ps aux # all processes with user, CPU, memory
ps aux | grep firefox # find certain processes
top # live overview (q quits)
htop # more comfortable variant, if installed
pgrep -a nginx # PIDs by nameIn top, %CPU and %MEM show the load. A process has a state, for example R running, S waiting, Z zombie (finished but not yet collected).
Signals
With kill you send a signal to a process:
kill PIDorkill -15 PID(SIGTERM): polite request to end. The program can clean up.kill -9 PID(SIGKILL): immediate end by the kernel, no clean-up. Only if needed.kill -HUP PID: many services reread their settings.Ctrl+Cin the terminal sends SIGINT,Ctrl+Zstops the process.killall nameandpkill nameact by name.
Foreground and background
command & starts in the background, jobs lists, fg brings it back. For long runners tmux and screen or a service under systemd is suitable.
See also: Memory management and the OOM killer