Display the status of a process
To view the processes, use the ps command.
When the ps command is executed, it will display the process information based on the information under /proc.
If the ps command is executed without any options, the process status of the user who executed the command will be displayed.
root@Lion:~# ps PID TTY TIME CMD 29939 pts/0 00:00:00 su 29940 pts/0 00:00:00 bash 30035 pts/0 00:00:00 ps ↑ Show the running processes of root root@Lion:~# su - root@Lion:~# su - nuy nuy@Lion:~$ ps PID TTY TIME CMD 29936 pts/0 00:00:00 bash 30041 pts/0 00:00:00 bash 30044 pts/0 00:00:00 ps ↑ Show running processes for user nuy |
●View the process status in detail
To display the process status in detail, run the ps command with the option "-l".
nuy@Lion:~$ ps -l F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 0 S 1000 29936 29935 0 80 0 - 1456 - pts/0 00:00:00 bash 4 S 1000 30041 30040 0 80 0 - 1456 - pts/0 00:00:00 bash 0 R 1000 30046 30041 0 80 0 - 2180 - pts/0 00:00:00 ps |
Information to be displayed
PID:A number that is automatically assigned to each process
TTY:Control terminal running the process
STAT:state
・Field 1
R:executable
T:Stopping or tracing
D:Dormant and uninterruptible.
S:dormant
Z:zombie(Not deleted, but suspended)
・Field 2
W:swapped out(No resident pages)
・Field 3
N:positive nice value
TIME:CPU consumption time
COMMAND:Execute command