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:
- Unix-style options: preceded by dash (-)
- BSD-style options: not preceded by dash. Represented by letters
- 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]
UID | User that ran the process |
PID | The process ID of the process |
PPID | The process ID of the parent process |
C | The processor utilization over the lifetime of the process |
STIME | The system time when the process was started |
TTY | The terminal device from which the process was created |
TIME | The total CPU time required to run the process |
CMD | The 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 -x | View only processes owned by you |
ps -T | View all processes associated with this terminal |
ps -r | View all running processes |
ps -C dhclient | Show process info by name |
ps -p 192 | Show process info by PID |
ps –ppid 1951 | Show child processes of this PPID |
ps -fU username | Show processes owned by username |
ps -fu 1000 | Show processes owned by this ID |
ps –forest | Print process tree |
ps -u bob | View effective username processes |
ps -U bob | View real username processes |