⚙️ What Is a Process in Linux?
A process is an active instance of a running program.
Every application or script you execute creates a process with a unique PID (Process ID).
Linux processes are categorized as:
-
Foreground (interactive):
Visible and directly controlled in the terminal. -
Background (non-interactive):
Run silently without blocking your shell.
📌 Example:firefox runs in the foreground, while cron jobs run in the background.
📋 Viewing Processes in Linux
The following commands help you inspect active processes and system load:
Common Process Viewing Commands
| Command | Purpose | Example |
|---|---|---|
ps aux |
List all running processes | Shows PID, CPU%, MEM% |
top |
Real-time resource monitor | Interactive system view |
htop |
Enhanced top (if installed) | Color-coded, scrollable process list |
pgrep |
Search processes by name | pgrep nginx |
🛑 Controlling Linux Processes
You can end, pause, or resume processes using these commands:
Process Control Commands
| Command | Purpose | Example |
|---|---|---|
kill PID |
Send signal (default: SIGTERM) | kill 2345 |
kill -9 PID |
Force kill (SIGKILL) | kill -9 2345 |
pkill name |
Kill by process name | pkill chrome |
jobs |
View background jobs | Lists job IDs |
fg %1 |
Bring job 1 to foreground | Used for suspended jobs |
bg %1 |
Resume job in background | Runs silently |
⚖️ Managing Process Priorities Using nice & renice
Linux uses nice values (−20 to +19) to adjust process priority.
-
Lower nice value = Higher priority
-
Higher nice value = Lower priority
Priority Tuning Commands
| Command | Purpose | Example |
|---|---|---|
nice -n 10 command |
Start a process with lower priority | nice -n 10 ./backup.sh |
renice -n 5 -p 1234 |
Change priority of running process | Adjusts process 1234 to nice value 5 |
🧠 Pro Tips for Process Management
✔ Use top or htop to quickly identify CPU/memory hogs
✔ Use kill -9 only as a last resort
✔ Avoid renicing system-critical services (e.g., sshd, systemd)
✔ Run long scripts in background:
./script.sh &
🚀 What’s Next?
Post #5:
We’ll dive into Linux package management — using apt, yum, and dnf to install, update, and remove software safely.
FAQs (3)
Sign in to ask a question. You can read FAQs without logging in.
Q: What should I do next after reading this blog?
A: Revisit the core points, especially this part: 'Learn how to monitor and control running processes in Linux using essential commands like ps, top, kill, and nice. This guide explains foreground vs background jobs, PIDs, and how to adjust process priority for better sy'. Practice commands in a lab VM, document outputs, and automate repeated checks using shell scripts or cron.
Q: Who should read this article and why?
A: This fits system admins, SOC analysts, and learners building practical Linux operations skills.
Q: What is the main takeaway from 'Managing Linux Processes: Monitor, Control, and Optimize ...'?
A: The key takeaway is mastering Linux administration basics that directly improve security, reliability, and troubleshooting.