When you start any application, Linux creates a process that runs until completion or termination. Understanding how to monitor and control these processes is essential for effective system administration and performance tuning.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Short-Lived vs. Long-Lived Processes
Short-Lived Processes
Commands likels spawn a process that exits immediately after running:
Long-Lived Processes
Daemons such assshd or long-running services remain active until explicitly stopped. To inspect active processes, the ps command is your first stop.
Inspecting Processes with ps
ps provides a snapshot of processes. It supports two option syntaxes:
| Syntax Style | Example | Description |
|---|---|---|
| Unix (POSIX) | ps -e | Standard options prefixed with a dash |
| BSD | ps axu | Options without a dash |
Use
man ps to explore all options and compare Unix vs. BSD syntax.Common ps Usage
-
Show processes in the current terminal:
-
List all system processes in user-oriented format:

man ps:
Real-Time Monitoring with top
For continuous updates:
- Use Up/Down arrows or
Page Up/Page Downto scroll. - Press
qto exit.
Filtering Processes
| Filter Type | Command Example |
|---|---|
| By PID | ps -p 1 -o pid,tty,stat,time,command |
| By User | ps -U aaron -u |
| By Name | pgrep -a syslog |
Adjusting Niceness (Priority)
Process priority (nice value) ranges from –20 (highest) to +19 (lowest).
-
Launch with niceness 11:
-
View niceness:
-
Change niceness of an existing PID:
Parent/Child Process Trees
Display processes as a hierarchy:
Sending Signals
Linux signals control process behavior. Common signals include:| Signal | Number | Default Action |
|---|---|---|
| SIGHUP | 1 | Hangup (reload config) |
| SIGINT | 2 | Interrupt |
| SIGTERM | 15 | Graceful termination |
| SIGKILL | 9 | Force kill |
| SIGSTOP | 19 | Pause |
| SIGCONT | 18 | Continue |
Killing your login shell (e.g.,
bash) will close your terminal or SSH session.Job Control: Background & Foreground
- Ctrl+C: Interrupt
- Ctrl+Z: Suspend
- Start in background:
sleep 300 & - List jobs:
jobs - Bring to foreground:
fg %1 - Send to background:
bg %1