How to Check and Monitor Running Processes in Linux
Introduction
Processes are the running programs on your Linux system. Monitoring them is critical for diagnosing performance issues, managing system resources, and troubleshooting errors. Linux provides several tools to check, monitor, and control processes effectively.
Step 1: View All Running Processes
Use the ps command:
ps aux
➡️ This shows all processes with details like process ID (PID), user, CPU usage, memory usage, and command.
Step 2: Real-Time Process Monitoring with top
Run:
top
➡️ This displays processes in real-time with resource consumption.
You can press q to quit.
For a modern interface with more details, install and use htop:
sudo apt install htop # Debian/Ubuntu
sudo yum install htop # CentOS/RedHat
htop
Step 3: Find a Specific Process
To search for a process by name:
ps aux | grep processname
➡️ Replace processname with the name of the process you’re looking for.
Step 4: Kill a Process
If a process is unresponsive, kill it using its PID:
kill -9 PID
➡️ Replace PID with the actual process ID from the ps or top output.
Step 5: Monitor System Activity with vmstat
Use:
vmstat 2
➡️ This displays real-time information about processes, memory, CPU, and I/O every 2 seconds.
Conclusion
Monitoring processes is an essential skill for Linux administrators. With tools like ps, top, and htop, you can quickly identify resource-hungry processes, troubleshoot performance problems, and keep your system running smoothly.

Comments
Post a Comment