• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

ps Command in Linux with Examples

{{postValue.id}}

ps Command

ps command is used to find the running processes of the system.

Syntax

ps

ps without any option

This is a very basic ps usage. It shows you process ID (PID), TTY command running place, Time and CMD.

Example

[user1@linuxhelp ~]$ps 
PID   TTY      TIME      CMD
7822  pts/3    00:00:00  su
7831  pts/3    00:00:00  bash
13061 pts/3    00:00:00  ps


This information is unsorted result.

Current Processes

The following command is used to view all the current running processes.
Option ' f' is used to display the detailed information about the process

Example

[user1@linuxhelp ~]$ ps ax 
PID  TTY       STAT    TIME  COMMAND
1     ?        Ss     0:01  /sbin/init
2     ?        S      0:00  [kthreadd]
3     ?        S      0:00  [migration/0]
4     ?        S      0:00  [ksoftirqd/0]
5     ?        S      0:00  [migration/0]
[user1@linuxhelp ~]$ ps -ef  -f 
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 09:14 ?        00:00:01 /sbin/init
root         2     0  0 09:14 ?        00:00:00 [kthreadd]
root         3     2  0 09:14 ?        00:00:00 [migration/0]
root         4     2  0 09:14 ?        00:00:00 [ksoftirqd/0]
root         5     2  0 09:14 ?        00:00:00 [migration/0]

Filter User Processes

The following command is used to filter a specific user processes

Example

[user1@linuxhelp ~]$ ps  -u  user1 
PID  TTY      TIME      CMD
3161 pts/0    00:00:00  bash
3345 pts/0    00:00:00  ps

Filter Processes by CPU or Memory usage

The following command is used to filter the processes by CPU or memory.

Example

[user1@linuxhelp ~]$ ps aux | less
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.1  0.0  19336   792 ?        Ss   09:14   0:01 /sbin/init
root         2  0.0  0.0      0     0 ?        S    09:14   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    09:14   0:00 [migration/0]
root         4  0.0  0.0      0     0 ?        S    09:14   0:00 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S    09:14   0:00 [migration/0]

Sort processes by highest CPU utilization

The following command is used to sort the processes by highest CPU utilization.

Example

[user1@linuxhelp ~]$ ps aux --sort &ndash pcpu | less 
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      3194 10.7 43.7 1198736 442508 ?      Sl   09:28   1:22 /usr/lib64/fire
fox/firefox
root      2336  1.6  6.5 164912 66060 tty1     Ss+  09:14   0:26 /usr/bin/Xorg :
0 -nr -verbose -audit 4 -auth /var/run/gdm/auth-for-gdm-ruguYX/database -noliste
n tcp vt1
root      3094  0.8  7.2 1108696 73600 ?       Sl   09:25   0:07 /usr/lib64/libr
eoffice/program/soffice.bin --writer file:///root/Desktop/ps_commands.docx --spl
ash-pipe=7

To Sort processes by highest memory utilization

The following command is used to sort the processes by highest memory utilization.

Example

[user1@linuxhelp ~]$ ps aux --sort &ndash pmem | less 
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  19336   960 ?        Ss   09:14   0:01 /sbin/init
root         2  0.0  0.0      0     0 ?        S    09:14   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    09:14   0:00 [migration/0]
root         4  0.0  0.0      0     0 ?        S    09:14   0:00 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S    09:14   0:00 [migration/0]

Filter Processes by name

The following command is used to filter processes by name.

Example

[user1@linuxhelp Desktop]# ps  -C  init 
PID TTY          TIME CMD
1 ?        00:00:01 init
[user1@linuxhelp Desktop]# ps -f -C firefox
UID        PID  PPID  C STIME TTY          TIME CMD
root      3194     1  9 09:28 ?        00:04:10 /usr/lib64/firefox/firefox


To show it in a full formatting list option -f option can be used along with it.

Process Thread

The following command is used to view the thread of the particular process.

Example

[user1@linuxhelp Desktop]# ps  -L  3194 
 PID   LWP TTY      STAT   TIME COMMAND
 3194  3194 ?        Sl     3:36 /usr/lib64/firefox/firefox
 3194  3213 ?        Sl     0:00 /usr/lib64/firefox/firefox
 3194  3214 ?        Sl     0:04 /usr/lib64/firefox/firefox
 3194  3215 ?        Sl     0:11 /usr/lib64/firefox/firefox
 3194  3216 ?        Sl     0:03 /usr/lib64/firefox/firefox
 3194  3217 ?        Sl     0:00 /usr/lib64/firefox/firefox
 3194  3218 ?        Sl     0:00 /usr/lib64/firefox/firefox

Processes Hierarchy

The following command is used to view the processes in hierarchical form.

Example

[user1@linuxhelp Desktop]# pstree 
init???NetworkManager
     ??abrtd
     ??acpid
     ??atd
     ??auditd???{auditd}
     ??automount???4*[{automount}]
     ??bonobo-activati???{bonobo-activat}
     ??certmonger
     ??clock-applet
     ??console-kit-dae???63*[{console-kit-da}]
[user1@linuxhelp ~]$ ps  axjf 
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
    0     2     0     0 ?           -1 S        0   0:00 [kthreadd]
    2     3     0     0 ?           -1 S        0   0:00  \_ [migration/0]
    2     4     0     0 ?           -1 S        0   0:00  \_ [ksoftirqd/0]
    2     5     0     0 ?           -1 S        0   0:00  \_ [migration/0]
    2     6     0     0 ?           -1 S        0   0:00  \_ [watchdog/0]
    2     7     0     0 ?           -1 S        0   0:04  \_ [events/0]
    2     8     0     0 ?           -1 S        0   0:00  \_ [cgroup]
    2     9     0     0 ?           -1 S        0   0:00  \_ [khelper]
    2    10     0     0 ?           -1 S        0   0:00  \_ [netns]

User Running the application

The following command is used to view the user who’ s the running the application with PID.

Example

[user1@linuxhelp ~]$ ps -eo pid,user,args 
PID USER     COMMAND
  1 root     /sbin/init
  2 root     [kthreadd]
  3 root     [migration/0]
  4 root     [ksoftirqd/0]
  5 root     [migration/0]

Tags:
jayce
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

How to display the all process list of current shell in Linux?

A

You just execute the "ps" command on a terminal to display the all process list of current shell in Linux. For Syntax: "ps".

Q

How do I know the entire detail with an option for "ps" command?

A

Use the "man" page of "ps" command to know the entire detail with an option for "ps" command. For syntax: "man ps".

Q

How to display the all running process under the "root" user by using the "ps" command?

A

You can use the following syntax to Display the all running process under the "root" user by using the "ps" command. For syntax: "ps -U root -u root"

Q

How can I fetch the process list of the certain group using the "ps" command?

A

You can use the option of "-g" (or) "-fg" with "ps" command to fetch the process list of a certain group using the "ps" command. For syntax: "ps -g apache" (or) "ps -fg apache"

Q

How to print the process tree structure using the "ps" command?

A

You can use the following syntax to print the process tree structure using the "ps" command. For syntax: "ps -e --forest"

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Owen ?
How to add SSH key to my Gitlab account

I need to add the SSH key in my gitlab account. How to do so ????

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.