← All cheatsheets

System

Process management — ps, kill, lsof, htop

Find and control processes: ps and htop, kill signals, lsof to see which process holds a port, and shell job control.

See processes

ps aux — all processes

ps aux | grep name — filter by name

pgrep name — get PID by name

htop / top — interactive monitor

Kill

kill PID — graceful (SIGTERM)

kill -9 PID — force (SIGKILL)

pkill name — kill by name

killall name — kill all matching

Network

lsof -i :PORT — what's using a port

netstat -tlnp — listening TCP ports (Linux)

ss -tlnp — modern netstat replacement

Background jobs (shell)

cmd & — run in background

jobs — list backgrounded

fg %1 — bring job 1 to foreground