A process is simply a program in execution. Every process is assigned a unique PID (Process ID).
| Command | Description |
|---|---|
ps aux |
Displays a snapshot of all running processes. |
top |
Real-time, interactive view of running processes. |
htop |
User-friendly, colorful version of top. Highly recommended for DevOps. |
kill -9 <PID> |
Forcefully stops a process that is stuck or misbehaving. |
Processes move through different states during their lifecycle:
| State | Description |
|---|---|
| Running (R) | Currently using the CPU. |
| Sleeping (S) | Waiting for an event to occur (like user input). |
| Stopped (T) | Suspended by a signal. |
| Zombie (Z) | Process has finished execution but still has an entry in the process table. |
A service (also called a daemon) is a type of process that runs in the background and performs specific tasks without direct user interaction. Services are commonly used to:
- Keep applications running continuously
- Handle system-level tasks (like logging, networking, or scheduling)
- Start automatically when the system boots
In Linux, services are usually managed using systemd via the systemctl command.
Instead of running applications manually, DevOps engineers run them as services so they stay active and manageable.
| Action | Command | Description |
|---|---|---|
| Start | sudo systemctl start <name> |
Starts the service immediately. |
| Stop | sudo systemctl stop <name> |
Stops the service immediately. |
| Restart | sudo systemctl restart <name> |
Stops and starts the service (used after config changes). |
| Status | sudo systemctl status <name> |
Shows if the service is running or has errors. |
| Enable | sudo systemctl enable <name> |
Configures the service to start automatically on boot. |
| Disable | sudo systemctl disable <name> |
Prevents the service from starting at boot. |