Contents
Notes from Bird’s Linux Private Kitchen (3rd edition), kept for quick review.
Process management
&
- Run in the background
- Stress test (fork bomb):
:(){ :|:& };:
ctrl+z
- Stop the process and push it to the background
bg
- Resume stopped background jobs
fg
- Bring jobs to the foreground; the job marked with
+is the default fg [%]num— pick a job numberfg -— switch to the other job in the rotation
jobs
-l— list PIDs with commands-r— running background jobs only-s— stopped background jobs only
kill
-l— list signals-SIGHUP# 1: reload-SIGINT# 2: Ctrl+C-SIGKILL# 9: force kill-SIGTERM# 15: polite terminate-SIGSTOP# 17: Ctrl+Z stopkill -SIGKILL %1— use%for shell job numbers, not PIDs
nohup
nohup command— keep running after logout (foreground)nohup command &— same, in the background
ps
-A— all processes (same as-e)-a— processes without a controlling terminal-u— processes for effective users-x— with-a, extra detail-l— long listing for your shell jobs, with PIDs- F — process flags: 4 = root; 1 = forked child without exec yet
- S — STAT: R running; S sleeping; D uninterruptible sleep; T stopped; Z zombie
-j— job control format-f— fuller outputaux— everything (note: no leading dash)axjf— process tree; likepstree-lA— same idea
top
-d seconds— refresh interval (default 5s)-bn num— batch mode fornumiterations-p— filter by PID
Interactive keys
?helpPsort by CPUMsort by memoryNsort by PIDTsort by CPU time (TIME+)ksend a signal to a PIDrchange nice value
- PRI(new) = PRI(old) + nice; lower PRI wins; root nice range -20..19, others 0..19
nice
n num— start with a given nice value
renice
renice num PID— retune a running process- Nice values inherit parent → child
pstree
-A— ASCII connectors-U— Unicode connectors-p— show PIDs-u— show owning user
killall
-i— interactive confirm-e— exact command name-I— case-insensitive match
free
-bbytes;mMB;kKB;gGB-t— show RAM plus swap totals
uname
-a— all fields-s— kernel name-r— kernel release-m— machine hardware-p— CPU type-i— hardware platform
uptime
- Boot time and 1/5/15-minute load averages
netstat
-a— all connections, listeners, and sockets-t— TCP-u— UDP-n— numeric host/port (skip name lookup)-l— listening sockets only-p— owning PIDnetstat -tlnp— listeners with PIDgrep 'rsync' /etc/services— map service to port
dmesg
- Kernel ring buffer from boot
dmesg | more— page through it
vmstat
-a— active/inactive instead of buffer/cache line-f— forks since boot-S unit (K,M)— output unit-d— disk read/write totals-p— per-partition disk statsvmstat 1 3— sample every 1s, three times
Questions? Leave a comment below or email: newbvirgil@gmail.com![]()
