Process Management
Monitoring and Controlling Processes with ps, top, htop, kill, and nice

Growing in DevOps, together! 🤝 | Associate Software Engineer at Tech Mahindra | Enthusiastic about automation, cloud solutions, and efficient software delivery. | Let's connect, collaborate, and learn from each other!
To maintain a healthy Linux system, you must be able to monitor and manage processes, and this guide outlines the essential tools.
1.ps
It is used shows information about active processes.
Syntax:
ps [OPTIONS]
ps - Shows the process of current shell
Output parameters
PID - unique process ID
TTY - terminal type of user logged in to
TIME - amount of CPU in min and sec that process has been running
CMD - name of the command that launched the process
To see all the running processes - for full format
ps -efIt displays a list of all processes currently running in the system, along with their associated process IDs (PIDs), terminal, status, and other information.

To see all the running process in BSD (Berkeley Software Distribution) format.
ps auxIdeally it gives you more information
It shows the process just like the task manager

To see the process by username
ps -u <user_name>

To display processes belonging to a specific group.
ps -G <group_name>
To view the process tree or to view processes hierarchically
ps -ejH
2.top
It provides a dynamic, real-time view of system processes.
Key Features:
Shows CPU and memory usage of processes.
Updates live every few seconds.
Allows interactive actions (kill, sort, etc.).
top

3.htop
It is an enhanced version of top, providing a more user-friendly interface.
Allows scrolling and mouse support.
Displays CPU and memory usage with graphs.
Lets you manage processes interactively.
htop

4.kill
Used to terminate a process manually.
Syntax:
kill [OPTIONS] [PID]
OPTION = signal name or no.
PID = Process ID
Common Signals:
| Signal | Number | Description |
SIGTERM | 15 | Gracefully stop a process |
SIGKILL | 9 | Forcefully kill a process |
SIGHUP | 1 | Restart a process |
5.nice
It starts a process with a specific priority.
Priority Range: -20 (highest) to 19 (lowest). Default is 0.
Syntax:
nice -n [priority] command
To Start a process with lower priority (less CPU usage):
nice -n 10 python script.py



