mirror of
https://github.com/thecyberlearn/devops-notes.git
synced 2026-08-18 07:32:51 +00:00
1.7 KiB
1.7 KiB
Linux – Process Management (Day 6)
What is a Process?
A process is a running program in Linux. Every application or service runs as a process.
Why Process Management is Important for DevOps?
DevOps engineers must:
- check if an app is running
- monitor CPU and memory usage
- stop or restart stuck applications
Most production issues are process-related.
View Running Processes
ps command
ps
ps aux
a → all users
u → user format
x → background processes
top Command
Shows live CPU and memory usage.
top
Exit:
q
htop (If Installed)
Better version of top.
htop
Find Process by Name
ps aux | grep nginx
Kill a Process
Normal kill
kill PID
Force kill (DANGEROUS)
kill -9 PID
⚠️ Use kill -9 only if normal kill fails.
Kill by Process Name
pkill nginx
Background & Foreground Jobs
Run in background:
command &
Example:
sleep 100 &
View jobs:
jobs
Bring to foreground:
fg
Check Process Using a Port
sudo netstat -tulnp
or
sudo ss -tulnp
Real DevOps Scenario
Problem: App not responding
Steps:
- Check if process is running
- Check CPU/memory usage
- Restart process
Commands:
ps
top
kill
Common Mistakes
- Killing wrong PID
- Using kill -9 unnecessarily
- Not checking process owner
DevOps Rule
✅ Inspect first
❌ Kill blindly
Summary
Today I learned Linux process management using ps, top, kill, and background jobs. These skills are essential for production servers.