1.12 Process Management
ps — Report Process Status Utility
Format:
ps [options]
Common Selection Options:
| Option | Architectural Meaning / Function |
|---|---|
| -e | Select all active processes. |
| -A | Select all active processes (identical to -e). |
| -a | Select all processes associated with a terminal, except session leaders. |
| -x | Select processes without controlling terminals. |
| -u | Select processes by effective user ID or name. |
Output Format Control Options:
| Option | Architectural Meaning / Function |
|---|---|
| -f | Generate a full-format listing. |
| -l | Generate a long-format listing. |
| -o | User-defined format (specify custom output fields). |
Examples:
$ ps -u root
$ ps -p 1234
$ ps -eo pid,ppid,cmd,%mem,%cpu
(Note: In the final example, pid, ppid, cmd, %mem, and %cpu are user-defined fields leveraged to explicitly identify the metrics represented in each output column).
top — Display Linux Tasks and Dynamic Process Monitor
Format:
top
Active process execution states are tracked using the flags R, S, D, and Z, defined as follows:
| State | Architectural Meaning |
|---|---|
| R | Running or Runnable (on execution queue) |
| S | Interruptible Sleep (waiting for an event to complete) |
| D | Uninterruptible Sleep (usually waiting for hardware IO) |
| Z | Zombie (terminated but parent has not reaped exit status) |
kill — Send a Signal to a Process
The most common use case is to terminate a target process execution sequence.
Format: kill [options] [signal] PID
Standard POSIX System Signals:
| Signal Name | Numeric Vector | Architectural Meaning / Default Action |
|---|---|---|
| SIGHUP | 1 | Controlling terminal hangup or configuration reload. |
| SIGINT | 2 | Keyboard interrupt signal (triggered via Ctrl+C). |
| SIGQUIT | 3 | Dump core and exit. |
| SIGKILL | 9 | Forceful termination kill signal (cannot be caught or ignored). |
| SIGTERM | 15 | Orderly termination signal (default signal sent by kill). |
| SIGCONT | 18 | Continue execution if currently stopped. |
| SIGSTOP | 19 | Stop process execution (cannot be caught or ignored). |
Common Options:
| Option | Functional Specification |
|---|---|
| -l | List all supported signal names. |
| -s | Specify the exact signal name to be sent. signal_name |
| -L | List signal names alongside their corresponding numeric vectors. |
Examples:
$ kill -l
$ kill -L
$ kill 1234
$ kill -9 1234
$ kill -SIGTERM 1234