Viewing processes

The ps (process status) is used to view information about running processes on a system. The ps utility reads these results from /proc filesystem. To look at currently running processes on the system, use ps command. Without arguments, ps command will show processes running in current shell.

The ps command uses three different styles of command-line options:

  1. Unix-style options: preceded by dash (-)
  2. BSD-style options: not preceded by dash. Represented by letters
  3. GNU long options: preceded by a double dash

Let’s examine the output of #ps -ef command

[aldin@arch tor-browser_en-US]$ ps -ef | head
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 11:47 ?        00:00:00 /sbin/init
root           2       0  0 11:47 ?        00:00:00 [kthreadd]
root           3       2  0 11:47 ?        00:00:00 [rcu_gp]
root           4       2  0 11:47 ?        00:00:00 [rcu_par_gp]
root           6       2  0 11:47 ?        00:00:00 [kworker/0:0H-kblockd]
root           8       2  0 11:47 ?        00:00:00 [mm_percpu_wq]
root           9       2  0 11:47 ?        00:00:00 [ksoftirqd/0]
root          10       2  0 11:47 ?        00:00:00 [rcuc/0]
root          11       2  0 11:47 ?        00:00:02 [rcu_preempt]
UIDUser that ran the process
PIDThe process ID of the process
PPIDThe process ID of the parent process
CThe processor utilization over the lifetime of the process
STIMEThe system time when the process was started
TTYThe terminal device from which the process was created
TIMEThe total CPU time required to run the process
CMDThe name of the program that was started in the process.
Brackets [] indicate the process is swapped out from physical memory (RAM) into virtual memory on hard drive

The ps command flags explained:

ps -xView only processes owned by you
ps -TView all processes associated with this terminal
ps -rView all running processes
ps -C dhclientShow process info by name
ps -p 192Show process info by PID
ps –ppid 1951Show child processes of this PPID
ps -fU usernameShow processes owned by username
ps -fu 1000Show processes owned by this ID
ps –forestPrint process tree
ps -u bobView effective username processes
ps -U bobView real username processes

Leave a Reply