Cheat SheetsLinuxProcesses

Processes — Cheat Sheet

Linux · 1 topics. Download the PDF or the Instagram carousel and share it.

Cheat Sheet · AiCanCode.org
Processes
Linux1 topicsQuick revision reference
1

Processes, Jobs & Signals

A process is a running program with its own PID, memory, and file descriptors. Linux tools like ps, top, htop, kill, and job control let you monitor, manage, and signal any process.

  • Every process has a PID, PPID, owner, state, and resource usage.
  • SIGTERM (15) is the polite stop signal; SIGKILL (9) is the forceful, uncatchable one.
  • Always try SIGTERM first — give the process a chance to clean up; use SIGKILL only as a last resort.
  • Ctrl-Z sends SIGSTOP (suspends); bg resumes in background; fg brings to foreground.
  • nohup + & or disown keeps processes running after logout.
  • SIGHUP is conventionally used to tell daemons (nginx, sshd) to reload their configuration.
bash — process inspection commands
# ps — process snapshot
ps aux
# USER  PID  %CPU %MEM    VSZ   RSS TTY  STAT  START   TIME COMMAND
# root    1   0.0  0.1 168940  9056 ?    Ss    10:00   0:01 /sbin/init
# akshay 1234 0.5  2.3 1234568 94012 pts/0 Sl  10:05   0:12 node server.js

# Columns explained:
# STAT: S=sleeping, R=running, Z=zombie, D=uninterruptible sleep, T=stopped
# VSZ: virtual memory (allocated, may not be in RAM)
# RSS: resident set size (actual RAM in use)

# Find a specific process
ps aux | grep nginx
pgrep nginx                 # just the PIDs
pgrep -a nginx              # PIDs + command names

# Process tree (who spawned whom)
pstree -p                   # full tree with PIDs
pstree -p 1234              # tree rooted at PID 1234

# top — live updating process list
top
# Press: q=quit, k=kill, r=renice, 1=per-CPU, M=sort by memory, P=sort by CPU
# htop — improved version with color, mouse support, F-key shortcuts
htop
Learn this free with Aria, your AI tutor → AiCanCode.org/learn/linux