Linux is a multi tasking and multi user operating system which can be run multiple processes at the same time. In order to accomplish these Linux can run multiple processes at the same time with different purposes, features, owners etc. The ps
command is used to list processes in different ways. the ps command can be used to list processes acording to their name, owner, session etc.
List User Interactive Processes
The ps command without option or parameter simply lists the interactive processes which are currently running. This is generally the bash shell and the ps command like below.
$ ps
List All Processes
All processes can be listed by using the -A
option like below. This provides information like Process ID, TTY, Time and CMD.
$ ps -A
List All Processes Not Associated with A Terminal
$ ps -a
List All Running(Active) Processes
Running processes can be listed with the -r
option.
$ ps -r
List All Processes For Current User
$ ps -x
List Processes for Specified Processes Name
We can list processes according to their name. The -C
option is used to specify process name.
$ ps -C nginx
List Processes for Specified Group Name
We can list processes for the specified group name. The -G
option is used to specify the group name.
$ ps -G adm
List Processes for Specified Process ID
A process can be listed according to its process id. The -p
option is used to specify the process ID.
$ ps -p 4232
List Processes In Full Format
The -F
option is used to list processes in detailed and full format.
$ ps -F
List Processes As Process Tree
The ps command can be used to list processes in a tree format. The parent and child relationships are displayed in a pretty print way. The --forest
option is used to list prcesses as tree.
$ ps --forest -x