Process Management Commands in Linux


 Introduction

In Linux, every running program is a process. As a system administrator or user, you need to monitor and control processes to ensure the system runs smoothly.


Step 1: View Running Processes (ps)

The ps command shows processes running in the current session.


ps


➡️ Use ps -ef to view all running processes on the system.


Step 2: Real-Time Process Monitoring (top)

The top command displays active processes and system resource usage.


top


➡️ Press q to quit the top screen.


Step 3: Kill a Process (kill)

The kill command stops a running process using its Process ID (PID).


kill 1234


➡️ Replace 1234 with the actual PID from ps or top.


Step 4: Kill by Name (pkill)

The pkill command kills a process by its name.


pkill firefox


➡️ This will stop all running instances of Firefox.


Step 5: Find a Process (pgrep)

The pgrep command searches for processes by name and shows their PIDs.


pgrep ssh


➡️ This will display the PID(s) of any SSH process.


Conclusion

Process management commands are essential for monitoring system performance and controlling applications. In the next post, we will learn about disk management commands to manage storage and check disk usage.

Comments