Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Processes

Every program you run becomes a process: a running instance with its own memory, its own user, and its own life cycle. Understanding processes is how you go from “the terminal is a place I type commands” to “the terminal is a system I control” — you can see what is running, steer what comes next, kill what has gone wrong, and keep things running after you log out.

This section covers the process toolkit. ps and top show what is running right now; htop shows it in color. kill, killall, pkill, and pgrep let you stop things by name or by process ID. jobs, bg, and fg manage the programs your shell is juggling. nice and renice control how much CPU a program gets, and nohup and wait keep programs alive and in sync. For the deeper tools — lsof, strace, ltrace — and for the system that starts everything at boot, see systemd Units.

Common Process Tools

CommandWhat It Does
psReport a snapshot of current processes.
topWatch processes live in the terminal.
htopA colorful, interactive upgrade to top.
killSend a signal to a process by PID.
killallKill processes by name.
pkillKill processes matching a pattern.
pgrepFind process IDs matching a pattern.
jobsList the shell’s background jobs.
bgResume a stopped job in the background.
fgBring a job back to the foreground.
niceRun a command with a chosen CPU priority.
reniceChange the priority of a running process.
nohupRun a command immune to hangups.
waitPause until background jobs finish.
lsofList which files and sockets processes have open.
straceTrace a program’s system calls.
ltraceTrace a program’s library calls.
systemd unitsServices, timers, and the tools that manage them.

Why This Matters

  • Servers break in the background. A process stuck in a loop or holding a port needs to be found and killed — by PID, by name, or by pattern.
  • Long jobs outlive your login. nohup, background jobs, and systemd units are how work keeps running after you close the terminal.
  • Everything you type becomes a process. The shell, ls, grep, every editor — process tools are how you observe the machine itself.

Learn this section and you can answer the two questions every Linux admin eventually faces: what is running on this machine? and how do I make it stop?