Understanding Linux Processes for Beginners: ps, top, htop, kill
If you’re just getting started with Linux server management, there’s one thing you must learn early: how to handle processes. Processes are basically the programs and tasks running on your server — some visible, many invisible. When something slows down, freezes, eats too much memory, or refuses to stop… knowing how to inspect and control processes becomes extremely important.
Don’t worry — you don’t need to be a guru to master this. I’ll walk you through each tool step by step, in the simplest way possible, like an older friend guiding you through your first Linux adventure.
What Are Processes in Linux? (Very Simple Explanation)
Think of your Linux system like a kitchen:
-
Each process is a chef working on a dish
-
Some chefs (background processes) work quietly
-
Some chefs (foreground processes) are loud and visible
-
Too many chefs can make the kitchen chaotic
-
And sometimes… you need to ask a chef to stop cooking
Tools like ps, top, htop, and kill help you “look into the kitchen” and keep things under control.
⭐ 1. Seeing Running Processes with ps
The ps command is like a snapshot — it shows what's running right now.
Example: Show All Processes
Explanation:
-
a— show processes for all users -
u— show the user who owns each process -
x— include background processes too
This gives you a long, detailed list. If you're new, this list might look intimidating — that’s okay. What matters is you can now see what’s running.
Useful Tip: Search for a specific process:
This helps you quickly find what you’re looking for.
⭐ 2. Real-Time Monitoring with top
top is like a live dashboard. It updates every few seconds and shows CPU, memory usage, process IDs, and more.
Run it with:
Inside top, you’ll see:
-
CPU usage
-
Memory usage
-
Load average
-
All processes sorted by resource usage
Helpful Keys Inside top:
-
P— sort by CPU usage -
M— sort by memory usage -
k— kill a process -
q— quit
This is perfect for spotting “greedy” processes that slow your server.
⭐ 3. A Friendlier Version of top: htop
If top feels too old-school, htop will feel like a modern upgrade.
Install it:
Run it:
Why beginners love htop:
-
Colorful
-
Easier to read
-
You can scroll
-
Interactive controls
You can sort by memory, CPU, user, and more — all with arrow keys.
Most administrators use htop every day because it’s just more comfortable.
⭐ 4. How to Kill a Process: Using kill
Sometimes, a process gets stuck…
Sometimes, it becomes a CPU monster…
Sometimes, an app refuses to close properly…
That’s when you need the kill command.
1. Find the Process ID (PID):
You’ll see a number — that’s the PID.
2. Stop the process gently:
3. If it refuses to stop, use force:
Important: Use -9 only when absolutely necessary — it’s like pulling the plug.
⭐ Real Life Example (Simple & Practical)
Let’s say your Node.js app froze.
Step 1 — Find it:
You find PID 1834.
Step 2 — Try stopping it:
If it still doesn’t stop:
Step 3 — Force it:
Done — problem solved.
⭐ When Should You Use Each Tool?
| Tool | Best For | Explanation |
|---|---|---|
| ps | Quick snapshot | Great for searching for a specific process |
| top | Live monitoring | Helps detect issues fast |
| htop | Comfortable monitoring | Easy for beginners, very visual |
| kill | Stopping problem processes | Necessary for troubleshooting |