🐧Go deeper — read the bookLinux for C++ Interviews: tracing a live process— runnable code & full walkthrough →

linux · medium

Processes & Signals — ps, kill, jobs, systemctl

Process & signal basics: ps -ef vs ps aux (and Z=zombie); SIGTERM (clean, catchable) vs SIGKILL (uncatchable, skips cleanup) plus HUP/USR1; and systemctl + journalctl for real services instead of nohup.

🔑 Key line

ps -ef (PPID) / ps aux (%CPU,STAT; Z=zombie). Signals: TERM(15) clean+catchable, KILL(9) uncatchable last-resort, HUP reload, USR1 app-defined. Real services: systemctl + journalctl -u -f.

The code

ps -ef # every process + parent PID (PPID)
ps aux # %CPU %MEM RSS STAT
kill -TERM 1234 # 15: polite, catchable -> clean shutdown (default)
kill -HUP 1234 # 1: reload config (by convention)
kill -USR1 1234 # 10: app-defined (e.g. bump log level)
kill -KILL 1234 # 9: uncatchable last resort -- NO cleanup
systemctl restart myapp ; journalctl -u myapp -f

What this lesson walks through

  1. 01List processes — and spot a zombie
  2. 02The signals that matter
  3. 03Real services use systemd

ps aux / ps -ef list processes; STAT 'Z' (zombie) means the child exited but the parent never wait()ed for it.

See it animated — step by step, at your own pace

Unlock the full interactive walkthrough of Processes & Signals — ps, kill, jobs, systemctl and 100+ animated C++ interview lessons.

← Previous
Who Owns This Port / FD? — lsof & /proc/PID/fd
Next →
Text Processing — grep, awk, sed, pipes & xargs