Intro

Updated

October 31, 2026

Intro

List, prioritize, signal, and background work. Covers classic job control in the shell as well as system-wide process tools (ps, top family, pgrep/pkill).

Commands in this part

Command Role
ps ps snapshots processes.
pstree pstree shows running processes as a tree, making parent/child relationships obvious — ideal for seeing what a…
top top is the classic interactive process monitor: CPU, memory, and a live-sorted process table.
htop htop is an interactive process viewer with a clearer UI than classic top: mouse support, tree view, easy…
procs procs is a modern replacement for ps written in Rust, with colorized output, tree views, keyword highlighting, and…
pgrep pgrep lists process IDs matching selection criteria (name, full command line, user, terminal, etc.).
pidof pidof prints the PIDs of running programs matched by name.
kill kill sends a signal to one or more processes by PID.
killall killall sends a signal to all processes matching a command name.
jobs jobs lists active jobs of the current shell: running background tasks, stopped jobs, and their job IDs.
fg fg resumes a job in the foreground, giving it the terminal again (stdin/stdout/signals).
bg bg resumes a stopped job in the background so it continues running without occupying the terminal.
nohup nohup runs a command immune to SIGHUP, so it keeps running after you log out of a terminal session.
timeout timeout runs a command and sends a signal if it still runs after a duration.
watch watch runs a command repeatedly, showing fullscreen output so you can see changes over time.
sleep sleep suspends execution for a specified time.
nice nice starts a command with a modified CPU niceness — a soft priority bias for the scheduler.
renice The renice command alters the scheduling priority of running processes.
ionice ionice sets or queries the I/O scheduling class and priority of a process (Linux CFQ/BFQ-oriented interface;…
taskset taskset reads and sets CPU affinity: which CPUs a process, or every one of its threads, may run on.
fuser fuser lists PIDs using a file, mount point, or network port.
ulimit ulimit is a shell builtin (bash/zsh/etc.) that shows or sets resource limits for the current shell and its child…
ipcs ipcs lists System V IPC objects: message queues, shared memory segments, and semaphore arrays.
ipcrm ipcrm removes System V IPC objects: shared memory segments, semaphore arrays, and message queues.
flock flock wraps a command or script section in a kernel file lock so two copies never run at once (cron overlap, deploy/backup mutual exclusion).
choom choom shows and sets a process’s OOM-killer bias (oom_score_adj); the chapter explains how the kernel scores and picks an OOM victim, globally and per memory cgroup.
pidfd pidfds are file descriptors that name one process and survive PID reuse: signal, wait, poll for exit (even of non-children), copy fds and identify socket peers without racing a recycled PID.
signalfd / timerfd / eventfd Signals, timers and cross-thread wake-ups as file descriptors in one epoll loop: blocking first, read-to-clear, coalesced counts, and the blocked mask that leaks into children.

Suggested starting points

  1. Inventory: ps, pstree, then interactive top/htop/btop.
  2. Select by name: pgrep / pidof before kill/killall.
  3. Job control in one shell: jobs, fg, bg, nohup.
  4. Priority, I/O class, and CPU placement: nice, renice, ionice, taskset.
  5. Limits and IPC: ulimit, ipcs/ipcrm, fuser.
  6. Mutual exclusion for jobs and scripts: flock.
  7. Out-of-memory victims: choom -p PID, /proc/PID/oom_score, and cgroup memory.events.
  8. Race-free process handles: pidfds (pidfd_open, pidfd_send_signal, waitid(P_PIDFD)) instead of saved PIDs.
  9. One event loop for signals, timers and wake-ups: signalfd, timerfd, eventfd with epoll.