Skip to main content

Command Palette

Search for a command to run...

Process Management

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

Updated
2 min read
Process Management
S

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

  1. To see all the running processes - for full format

     ps -ef
    

    It displays a list of all processes currently running in the system, along with their associated process IDs (PIDs), terminal, status, and other information.

  2. To see all the running process in BSD (Berkeley Software Distribution) format.

     ps aux
    

    Ideally it gives you more information

    It shows the process just like the task manager

  3. To see the process by username

     ps -u <user_name>
    

  4. To display processes belonging to a specific group.

     ps -G <group_name>
    
  1. 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:

SignalNumberDescription
SIGTERM15Gracefully stop a process
SIGKILL9Forcefully kill a process
SIGHUP1Restart 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