DEV Community

Cover image for Viewing Processes with ps, top and htop
Sana Muhammad Sadiq
Sana Muhammad Sadiq

Posted on

Viewing Processes with ps, top and htop

Introduction

As I continue my 30-Day Linux Challenge for RHCSA preparation with the #CloudWhistler community led by Ali Sohail. Today I’m diving into a topic that helps you see what's really happening inside your Linux system process monitoring. In this article, I’m exploring three powerful commands: ps, top and htop.

Index

  1. What Are Processes in Linux
  2. ps Process Snapshot
  3. top Real Time Process Viewer
  4. htop Enhanced Top
  5. Real Life Use Cases
  6. Recommendations
  7. Quick Summary

🧠 What Are Processes in Linux?

Every running task or application in Linux is a process. These include services, system tasks and commands you run in the terminal.

Being able to view and manage processes is essential to troubleshoot, monitor system load and understand how your machine is performing.

🔍 ps Process Snapshot

The ps command gives you a snapshot of currently running processes.

Basic usage:

ps
Enter fullscreen mode Exit fullscreen mode

Image description

Show all processes with detailed output:

ps aux
Enter fullscreen mode Exit fullscreen mode

Image description

Filter by user:

ps -u sana
Enter fullscreen mode Exit fullscreen mode

Image description

Search by process name:

ps aux | grep firefox
Enter fullscreen mode Exit fullscreen mode

Image description

📊 top Real Time Process Viewer

The top command shows a dynamic, real-time view of system processes.

Just run:

top
Enter fullscreen mode Exit fullscreen mode

Image description

Use keyboard shortcuts inside top:

  • k to kill a process
  • q to quit
  • P to sort by CPU usage
  • M to sort by memory usage

📌 Pro Tip: It’s already available on most Linux systems by default!

🚀 htop Enhanced Top

If you want a more interactive and colorful view, try htop. It offers a scrollable interface and allows you to manage processes with your keyboard.

Install htop:

sudo dnf install htop     # RHEL/Fedora
sudo apt install htop     # Ubuntu/Debian
Enter fullscreen mode Exit fullscreen mode

Image description

Run it:

htop
Enter fullscreen mode Exit fullscreen mode

Image description

🟢 Use arrow keys to scroll, F9 to kill a process and F10 to quit.

💼 Real Life Use Cases

  • 🛠️ Troubleshooting slow systems
  • 🧠 Identifying memory or CPU-heavy applications
  • 🧹 Killing unresponsive background services
  • 🛡️ Monitoring server performance in real-time

🌱 Recommendations

  • Use ps when you want a quick look at what's running.
  • Use top or htop when you want live monitoring.
  • Don’t kill processes unless you know what they do.

✅ Quick Summary

Command Use Case
ps Quick snapshot of processes
top Live process monitoring
htop Interactive and user-friendly process viewer

If you’ve ever wondered how to peek under the hood of your Linux machine, these tools are your go-to companions. And yes once you get used to htop, there’s no going back. 😄

Image description

I'd love to hear your thoughts, insights or experiences with Linux. Feel free to share and join the conversation [ Connect with me on LinkedIn www.linkedin.com/in/techwithsana ]💜

#30dayslinuxchallenge #redhat #networking #cloudcomputing #cloudengineer #cloudarchitect #cloud #RHCSA #RHCE #RHEL #WomeninTech #Technology

Top comments (0)