👁️ Viewing Running Processes
Think of processes like people working in an office. Each process is doing a task, like sending an email, running a program, or playing music. Sometimes you want to see who's working or what tasks are running, and Linux gives you tools for that.
1a. ps Command
What it does: Shows a snapshot of processes running at the moment you run the command.
Analogy: It's like looking at a printed list of employees at their desks right now.
- a → all users' processes
- u → show user/owner of process
- x → include processes not attached to a terminal
You'll see columns like:
- USER → who owns the process
- PID → Process ID (like employee ID)
- %CPU / %MEM → how much CPU or memory it's using
- COMMAND → what program is running
Practical tip: Use ps aux | grep firefox to see if Firefox is running.
1b. top Command
What it does: Shows processes live, updating every few seconds.
Analogy: Like a live CCTV feed of your office, showing who's working right now.
Features:
- Lists processes using the most CPU at the top
- Shows memory usage, uptime, number of running tasks
Practical tip: Press q to quit, or M to sort by memory usage.
1c. htop Command
What it does: Fancy, interactive version of top.
Analogy: Like a touchscreen dashboard where you can see workers, click on them, and even ask them to pause their task.
Features:
- Color-coded display for CPU, memory, and process status
- Navigate using arrow keys
- Kill or renice processes directly from interface
Note: You may need to install it first:
Real-life analogy
✅ Key takeaway:
ps → snapshot list
top → live feed
htop → interactive live feed
I'll pause here.
Do you understand Viewing Running Processes or should I clarify anything before we move on to Killing or Stopping Processes?