Process Management — Viewing and controlling running processes
htop
Process Management
Interactive process viewer (enhanced top)
htop
htop
Install with: sudo apt install htop. Use F9 to kill, F6 to sort, F5 for tree view.
journalctl
Process Management
Query the systemd journal (logs)
journalctl [OPTIONS] [MATCHES]
journalctl -u nginx journalctl -u myapp -n 50 journalctl -u myapp -f journalctl --since "1 hour ago"
kill
Process Management
Send a signal to a process
kill [OPTIONS] PID
kill 1234 kill -9 1234 kill -SIGTERM 1234
Get the PID from ps aux or pgrep. Use -9 only if graceful shutdown fails.
nohup
Process Management
Run a command immune to hangups
nohup COMMAND [ARGS] &
nohup python script.py & nohup ./server.sh > output.log 2>&1 &
Output goes to nohup.out by default. Use & to run in the background.
pgrep
Process Management
Find processes by name
pgrep [OPTIONS] PATTERN
pgrep nginx pgrep -l python
pkill
Process Management
Kill processes by name
pkill [OPTIONS] PATTERN
pkill nginx pkill -9 python
ps
Process Management
Report a snapshot of current processes
ps [OPTIONS]
ps aux ps aux | grep nginx ps -ef
Pipe to grep to find a specific process: ps aux | grep python
screen
Process Management
Terminal multiplexer — keep sessions alive after disconnect
screen [OPTIONS] [COMMAND]
screen -S mysession screen -r mysession screen -ls
Inside screen: Ctrl+A then D to detach. Ctrl+A then K to kill.
systemctl
Process Management
Control the systemd system and service manager
systemctl COMMAND [UNIT]
sudo systemctl start nginx sudo systemctl stop nginx sudo systemctl restart nginx sudo systemctl status nginx sudo systemctl enable nginx sudo systemctl disable nginx sudo systemctl daemon-reload
top
Process Management
Display Linux processes in real time
top
top top -u alice
Press q to quit, k to kill a process, M to sort by memory, P to sort by CPU.