How to view Processes

From Linux Shell Scripting Tutorial - A Beginner's handbook
Revision as of 15:27, 17 July 2017 by Admin (talk | contribs) (Text replacement - "" to "")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
← What is a Process?HomeSending signal to Processes →

You need to use the ps command, pstree command, and pgrep command to view a snapshot of the current processes.

ps - View process

To view current process use the ps command:

ps aux | less
ps aux | grep "process-name"
ps aux | grep "httpd"
ps alx | grep "mysqld"

pstree - Display a tree of processes

To display a tree of processes use the pstree command:


Sample outputs:

     │           └─gnome-session─┬─gnome-panel
     │                           ├─gpg-agent
     │                           ├─metacity
     │                           ├─nautilus
     │                           ├─python
     │                           ├─seahorse-agent
     │                           ├─ssh-agent
     │                           ├─tracker-applet
     │                           ├─trackerd───2*[{trackerd}]
     │                           ├─update-notifier
     │                           └─{gnome-session}
     │                ├─bash───ssltx───ssh
     │                ├─gnome-pty-helpe
     │                └─{gnome-terminal}
     │                    ├─hald-addon-cpuf
     │                    ├─hald-addon-inpu
     │                    └─hald-addon-stor
     │      └─jsvc───39*[{jsvc}]
     │             └─mysqld───10*[{mysqld}]
     │            └─2*[{pulseaudio}]

pgrep - Look up processes

pgrep looks through the currently running processes and lists the process IDs which matches the selection criteria to screen. List the processes called php-cgi AND owned by vivek user.

pgrep -u vivek php-cgi

To list the processes owned by vivek OR krish.

pgrep -u vivek,krish

External links

← What is a Process?HomeSending signal to Processes →