Understanding how to manage processes is fundamental for any Linux administrator. A process is simply a running instance of a program, from short-lived commands likeDocumentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
ls to long-running services.
1. Launching a Process
For example, running:ls process that exits once the directory contents are shown.
2. Inspecting Processes with ps
The ps command lists active processes. It has two distinct option styles:
| Syntax Style | Example | Description |
|---|---|---|
| UNIX-style | ps -e | Show every process |
| BSD-style | ps axu | All processes in user-oriented format |
a (others’ processes), x (no controlling terminal), and u (user format):
2.1 Exploring ps Options

- Full format
- Process tree
- Thread details
2.2 Understanding ps aux Columns
| Column | Description |
|---|---|
| USER | Process owner |
| PID | Process ID |
| %CPU | CPU usage at sample time |
| %MEM | Physical memory usage |
| VSZ | Virtual memory size (KB) |
| RSS | Resident Set Size (KB) |
| STAT | Process state |
| START | Start time or date |
| TIME | Cumulative CPU time |
| COMMAND | Command with arguments |
Kernel threads run in kernel space and appear in square brackets, e.g.,
[kworker/0:1].3. Real-Time Monitoring with top
To watch processes live:
- Use arrow keys or Page Up/Page Down to navigate.
- Press
Qto quit.
4. Targeted Process Listings
| Task | Command |
|---|---|
| By PID | ps -p 1 or ps -p 1 -u |
| By user | ps -u aaron |
By name (with pgrep) | pgrep -a syslog |
5. Managing Process Priority (Niceness)
Niceness spans -20 (highest priority) to 19 (lowest). Lower niceness → higher scheduling priority.5.1 Launching with nice
5.2 Viewing Niceness
5.3 Changing with renice
6. Signals and kill
Linux uses signals to control processes:
| Signal | Number | Description |
|---|---|---|
| SIGHUP | 1 | Hangup/reload |
| SIGINT | 2 | Interrupt (Ctrl+C) |
| SIGTERM | 15 | Graceful shutdown |
| SIGKILL | 9 | Force kill (uncatchable) |
SIG prefix:
Using
SIGKILL (kill -9) does not allow cleanup and may leave resources in an inconsistent state. Use SIGTERM first.Example: Restarting sshd
7. Shell Job Control
| Action | Keystroke or Command |
|---|---|
| Interrupt (SIGINT) | Ctrl+C |
| Pause/Stop (SIGTSTP) | Ctrl+Z |
| Background a command | sleep 180 & |
| List jobs | jobs |
| Bring job to foreground | fg %1 |
| Resume in background | bg %1 |
8. Open Files with lsof
- List files opened by a PID:
- Find which process holds a file:
Use
sudo when required to avoid permission denied errors.That concludes our guide on creating, monitoring, and killing processes in Linux. Practice these commands in a lab environment to master process management.
Links and References
- ps(1) — Linux Manual Page
- top(1) — Linux Manual Page
- kill(1) — Linux Manual Page
- lsof(8) — Linux Manual Page