Skip to content

Understanding processes

Every running program is a process with a number, the PID. Every process (except PID 1) was started by another process, its parent (PPID).

Process states, as shown by ps and top in the STAT or S column:

State Meaning
R Running, or waiting for the CPU
S Sleeping, waiting for an event (most processes, most of the time)
D Waiting for disk or network I/O, can't be interrupted
T Stopped, for example with Ctrl+Z
Z Zombie: finished, but the parent hasn't collected its exit status yet

The most important signals:

Signal Number Meaning Typical use
HUP 1 Hang up Many services reload their configuration
INT 2 Interrupt What Ctrl+C sends
KILL 9 Kill End immediately, the process can't react (last resort)
TERM 15 Terminate End cleanly, the default of kill
STOP 19 Stop Pause the process
CONT 18 Continue Let a stopped process continue

Services belong to systemd

Services like nginx or PostgreSQL are started and stopped with systemctl, which is covered in the chapter on systemd. The commands in this chapter help you find out what is running and handle processes that don't react any more.