How to List All Processes in Linux {5 Different Commands} (2024)

Introduction

Each application you use, or a command you run on your Linux system creates a process or task. A system administrator must manage processes effectively to ensure optimal system performance.

This tutorial covers different Linux commands to list running processes in Linux.

How to List All Processes in Linux {5 Different Commands} (1)

Prerequisites

  • A system running Linux (this tutorial uses Ubuntu 22.04).
  • An account with root or sudo privileges.
  • Access to the terminal.

List Running Processes in Linux

A process in Linux starts every time you launch an application or run a command. While each command creates one process, applications create and run multiple processes for different tasks.

By default, each new process starts as a foreground process. This means it must finish before a new process begins. Running processes in the background allows you to perform other tasks simultaneously.

Note: Learn more about terminating Linux processes in our guide to killing processes in Linux.

To list currently running processes, use the ps, top, htop, and atop Linux commands. To identify individual processes, combine the ps command with the pgrep command

List Linux Processes Using ps Command

The Linux ps command creates a snapshot of the currently running processes. Unlike the other commands on this list, ps presents the output as a static list that is not updated in real time.

The ps command uses the following syntax:

ps [options]

Frequently used ps command options include:

OptionDescription
-aLists all processes except session leaders (instances where the process ID is the same as the session ID) and processes not associated with a terminal.
-A, -e Lists all processes on the system.
-dLists all processes except session leaders.
--deselect, -N Displays processes that do not match the specified criteria.
-fDisplays full-format listing.
-jDisplays output in the jobs format.
-tLists all processes associated with this terminal.
-r Lists only running processes.
-u Displays processes for a specific user.
-xIncludes processes without controlling terminals.
-pDisplays processes for a specific process ID (PID).
-CDisplays processes based on command name.
--sortSorts the processes based on specified criteria.
aShows all processes for all users.
uLists processes with detailed information.
xIncludes processes without a controlling terminal.

Note: Check the complete list of ps command options using man ps.

Run the ps command without any options :

ps

How to List All Processes in Linux {5 Different Commands} (2)

The default output includes the following categories:

  • PID. Process identification number.
  • TTY. The type of terminal the process is running on.
  • TIME. The total CPU usage.
  • CMD. The name of the command that started the process.

Using the combination of a, u, and x options results in a more detailed output:

ps aux
How to List All Processes in Linux {5 Different Commands} (3)

The expanded output with new categories include:

  • USER. The name of the user running the process.
  • %CPU. The CPU usage percentage.
  • %MEM. The memory usage percentage.
  • VSZ. The total virtual memory used by the process, in kilobytes.
  • RSS. The resident set size, the RAM portion occupied by the process.
  • STAT. The current process state.
  • START. The time the process was started.

To display the running processes in a hierarchical view, enter:

ps -axjf
How to List All Processes in Linux {5 Different Commands} (4)

Note: When using more than one ps command option containing a dash symbol ("-"), you only need to use one dash symbol before listing the options. For instance, to use the ps command with the -e and -f options, type ps -ef.

List Linux Processes Using top Command

The top command displays the list of running processes in the order of decreasing CPU usage. This means the most resource-heavy processes appear at the top of the list:

top
How to List All Processes in Linux {5 Different Commands} (5)

The top command output updates in real time, with the three-second default refresh rate. The top command output contains the following categories:

  • PID. Process identification number.
  • USER. The name of the user running the process.
  • PR. The scheduling priority for the process.
  • NI. The nice value of the process, with negative numbers indicating higher priority.
  • VIRT. The amount of virtual memory used by the process.
  • RES. The resident (physical) memory amount used by the process.
  • SHR. The total shared memory used by the process.
  • S. The process status: R (running), I (idle), or S (sleeping).
  • %CPU. The CPU usage percentage.
  • %MEM. The memory usage percentage.
  • TIME+. The total CPU usage amount.
  • COMMAND. The name of the command that started the process.

List Linux Processes Using htop Command

The htop command offers the same output as the top command. However, it is easier to understand and more user-friendly.

Note: Most Linux distributions don't include this command. Install it with sudo apt install htop.

The htop command provides the following output:

htop
How to List All Processes in Linux {5 Different Commands} (6)

Use the following keys to interact with the htop command:

  • Directional keys. Scroll the process list vertically and horizontally.
  • F1. Opens the help window.
  • F2. Opens the htop command setup.
  • F3. Searches for a process by typing the name.
  • F4. Filters the process list by name.
  • F5. Switches between showing the process hierarchy as a sorted list or a tree.
  • F6. Sorts processes by columns.
  • F7. Decreases the nice value (increase priority) of a process.
  • F8. Increases the nice value (decrease priority) of a process.
  • F9. Kills the selected process.
  • F10. Exits the command interface.

List Linux Processes Using atop Command

The atop command provides a more comprehensive overview of the running processes compared to the top command.

Note: If the atop command is not installed on your machine, install it with sudo apt install atop.

The atop command creates the following output:

atop
How to List All Processes in Linux {5 Different Commands} (7)

The heading section of the output provides an overview of system resources, including process and performance-related statistics and memory, disk, and network usage.

The lower section lists currently running processes and contains the following categories:

  • PID. Process identification number.
  • SYSCPU. The CPU usage by the process.
  • USRCPU. The CPU usage by the process while running in user mode.
  • VGROW. The virtual memory amount the process has occupied since the last output update.
  • RGROW. The physical memory amount the process has occupied since the last output update.
  • RUID. The real user ID of the user that started the process.
  • ST. The current process status.
  • EXC. The exit code after the process terminates.
  • THR. The number of threads the process is using.
  • S. The current status of the primary thread of the process.
  • CPUNR. The number of CPUs used by the process.
  • CPU. The CPU percentage used by the process.
  • CMD. The name of the command that started the process.

Using the atop command with the following options changes the output format:

OptionDescription
-aLists active processes only.
-c Shows the command line arguments per process.
-d Sorts processes by most active resources.
-l Prints total values as average-per-second.
-m Shows memory information.
-n Displays network information.
-s Shows process scheduling information.
-v Prints the verbose output.
-yDisplays individual threads.
a Sorts processess by most active resources.
cShows the command line per process
m Sorts processes by memory usage.
nSorts processes by network activity.

List Linux Processes Using pgrep Command

Using the pgrep command allows you to search for a specific process. The pgrep command uses the following syntax:

pgrep [process name]

For instance, use the following command to search for the firefox process:

pgrep firefox
How to List All Processes in Linux {5 Different Commands} (8)

The command output lists the process PID:

Using this PID with the ps command allows you to get more information about the process. In this example, using the PID 19327 provides information for the Firefox process:

ps -e | grep 19327
How to List All Processes in Linux {5 Different Commands} (9)

Conclusion

This tutorial explains several commands for listing and managing running processes in Linux. Choose the command that suits you best to manage your Linux system.

Next, learn about other important Linux commands.

How to List All Processes in Linux {5 Different Commands} (2024)
Top Articles
The 10 Highest Paying Jobs with a Teaching Degree
Strauss Troy Law Firm News
Katie Nickolaou Leaving
Angela Babicz Leak
Ghosted Imdb Parents Guide
Ds Cuts Saugus
Farmers Branch Isd Calendar
Western Razor David Angelo Net Worth
Tabler Oklahoma
Geometry Escape Challenge A Answer Key
Unit 1 Lesson 5 Practice Problems Answer Key
Audrey Boustani Age
The Binding of Isaac
Wordscape 5832
More Apt To Complain Crossword
The most iconic acting lineages in cinema history
charleston cars & trucks - by owner - craigslist
Connect U Of M Dearborn
Sky X App » downloaden & Vorteile entdecken | Sky X
Q33 Bus Schedule Pdf
Committees Of Correspondence | Encyclopedia.com
使用 RHEL 8 时的注意事项 | Red Hat Product Documentation
De beste uitvaartdiensten die goede rituele diensten aanbieden voor de laatste rituelen
Army Oubs
TBM 910 | Turboprop Aircraft - DAHER TBM 960, TBM 910
Katie Sigmond Hot Pics
Village
Dmv In Anoka
Beaufort 72 Hour
Relaxed Sneak Animations
Tamil Movies - Ogomovies
Ordensfrau: Der Tod ist die Geburt in ein Leben bei Gott
Planned re-opening of Interchange welcomed - but questions still remain
How To Make Infinity On Calculator
O'reilly's Wrens Georgia
Emily Katherine Correro
Craigslist Free Stuff San Gabriel Valley
Xemu Vs Cxbx
Santa Cruz California Craigslist
Polk County Released Inmates
Sadie Sink Doesn't Want You to Define Her Style, Thank You Very Much
Greater Keene Men's Softball
Pensacola Cars Craigslist
Saybyebugs At Walmart
2 Pm Cdt
Wal-Mart 140 Supercenter Products
Www Craigslist Com Atlanta Ga
Uc Davis Tech Management Minor
How the Color Pink Influences Mood and Emotions: A Psychological Perspective
Overstock Comenity Login
One Facing Life Maybe Crossword
Latest Posts
Article information

Author: Nathanial Hackett

Last Updated:

Views: 6127

Rating: 4.1 / 5 (52 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Nathanial Hackett

Birthday: 1997-10-09

Address: Apt. 935 264 Abshire Canyon, South Nerissachester, NM 01800

Phone: +9752624861224

Job: Forward Technology Assistant

Hobby: Listening to music, Shopping, Vacation, Baton twirling, Flower arranging, Blacksmithing, Do it yourself

Introduction: My name is Nathanial Hackett, I am a lovely, curious, smiling, lively, thoughtful, courageous, lively person who loves writing and wants to share my knowledge and understanding with you.