Processes
Finding running programs, watching CPU and memory, stopping processes that hang, and
controlling jobs and priorities.
Basics: PID, process states and signals
Find processes
-
ps
Show running processes with CPU, memory and command line.
-
pgrep
Find PIDs by name, user or command line.
-
pidof
Print the PIDs of a running program.
-
pstree
Show processes as a tree of parents and children.
Watch the system
-
top
Watch CPU, memory and the busiest processes live.
-
htop
Comfortable live view with search, filter and tree.
-
free
Used, free and available memory and swap.
-
lsof
Open files, ports and who holds them.
-
watch
Run a command repeatedly and watch it change.
Stop processes
-
kill
Send a signal to a process by PID.
-
pkill
Send a signal to processes by name.
-
killall
Signal all processes with an exact name.
-
timeout
End a command after a time limit.
Jobs and background
-
jobs
Background and paused commands of this shell.
-
bg
Continue a paused job in the background.
-
fg
Bring a job back to the foreground.
-
nohup
Keep a command running after logout.
Priorities