Processes: An Overview
In Linux, a process is an instance of a running program. Understanding how to view and manage these processes is a fundamental skill for any system administrator or developer. This section provides an overview of the key commands for process management.
Key Commands
| Command | Purpose |
|---|---|
ps | Displays a snapshot of current processes. |
top & htop | Provides a real-time, dynamic view of system processes and resource usage. |
kill, pkill & killall | Sends a signal to a process to terminate it. |
lsof | Lists all open files and the processes that are using them. |
fuser | Identifies which processes are using a specific file, directory, or socket. |
Process State
Processes can exist in several states. Here are some of the most common ones you'll see when using commands like ps or top:
- R (Running or Runnable):** The process is currently executing or is ready to run.
- S (Sleeping):** The process is waiting for an event to complete (e.g., waiting for I/O).
- T (Stopped):** The process has been stopped by a job control signal (e.g., Ctrl-Z).
- Z (Zombie):** The process has terminated, but its parent process has not yet collected its exit status.
- D (Uninterruptible Sleep):** The process is in an uninterruptible wait, typically for hardware I/O.