htop/ps — Process Management Tools
Linux process management is an essential skill for all ops and developers. This cheatsheet covers everything from basic `ps` viewing to advanced `strace` syscall tracing, along with `htop` real-time monitoring, signal sending, priority adjustment, and more.
Updated: 2026-07-17·31 commands
Overview
Process management is a fundamental skill for Linux system administration. This cheatsheet covers process monitoring, signal handling, priority management, and real-time system monitoring.
Quick Start
``bash
ps aux | grep nginx # Find nginx processes
top # Interactive process viewer
kill -15 PID # Gracefully terminate a process
``
Refer to the command table below for detailed usage.
Process View(8)
| Command | Level | ||
|---|---|---|---|
ps auxShow all processes for all users (BSD style) | Basic | ps aux | grep nginx | |
ps -efShow all processes (System V style) | Basic | ps -ef | grep java | |
ps -uShow processes for a specific user | Basic | ps -u www-data | |
ps --forestDisplay process hierarchy as a tree | Intermediate | ps aux --forest | |
pstreeDisplay processes as a tree diagram | Basic | pstree -p 1234 | |
pgrepLook up process IDs by name | Intermediate | pgrep -u www-data nginx | |
lsofList open files and network connections by process | Intermediate | lsof -i :8080 | |
wShow who is logged on and what they are doing | Basic | w |
Monitoring(9)
| Command | Level | ||
|---|---|---|---|
topDisplay real-time process activity (sorted by CPU by default) | Basic | top -u mysql | |
htopEnhanced real-time process monitor | Basic | htop -p 1234,5678 | |
screenTerminal multiplexer (persists sessions) | Intermediate | screen -S mysession | |
straceTrace system calls and signals | Expert | strace -p 1234 -e trace=open,read | |
watchPeriodically execute a command | Basic | watch -n 2 'ps aux --sort=-%cpu | head -10' | |
uptimeShow system uptime and load averages | Basic | uptime | |
freeDisplay system memory usage | Basic | free -h | |
vmstatReport virtual memory statistics | Intermediate | vmstat 2 5 | |
iostatReport input/output statistics | Intermediate | iostat -x 2 |
Signals(10)
| Command | Level | ||
|---|---|---|---|
killSend a signal to a process | Basic | kill -15 1234 | |
killallKill all processes matching a name | Intermediate | killall -9 nginx | |
pkillMatch by name or attribute and send signal | Intermediate | pkill -f "python script.py" | |
kill -lList all available signal names | Intermediate | kill -l | |
nohupRun a process immune to hangups | Intermediate | nohup long-running.sh & | |
disownRemove a job from the shell's job table | Intermediate | disown %1 | |
bgResume a suspended job in the background | Basic | bg %2 | |
fgBring a background job to the foreground | Basic | fg %1 | |
jobsList background jobs of the current shell | Basic | jobs -l | |
timeoutRun a command with a time limit | Intermediate | timeout 30 ./long-task.sh |
Priority(4)
| Command | Level | ||
|---|---|---|---|
niceStart a process with a specified priority | Intermediate | nice -n 10 ./backup.sh | |
reniceChange the priority of a running process | Intermediate | renice -n 5 -p 1234 | |
tasksetSet or retrieve a process's CPU affinity | Expert | taskset -pc 0-3 1234 | |
ioniceSet or retrieve I/O scheduling priority | Expert | ionice -c 2 -n 7 -p 1234 |
FAQ
This cheatsheet is compiled from official tool documentation. Last updated: 2026-07-17.