Wednesday 20 March 2013

Linux processes

To find a process

Use pgrep command. pgrep looks through the currently running processes and lists the process IDs which matches the selection criteria to screen. For example display firefox process id:
# pgrep firefox
Sample outputs:
3356
 
or
# pidof firefox
3356  
 
Following command will list the process called sshd which is owned by a user called root:
$ pgrep -u root sshd


# ps 3356
Sample outputs:
PID   TTY  STAT   TIME   COMMAND
3356  ?    ..     ..     /path/to/executable
 
pstree shows running processes as a tree.  If a user name is specified, all process trees rooted at processes owned by that user are shown.
$ pstree
 
ps -u user  will show all processes of the user "user"
 $ ps -u user

No comments:

Post a Comment