Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".(Japanese Version)

Show only running processes and specific processes

Show only running processes and specific processes

●View running processes

The ps command basically shows all the processes that are not completed, so it will also show the processes that are stopped.
To show only running processes, run the ps command with the option "-r".

root@Lion:~# ps -axr
  PID TTY      STAT   TIME COMMAND
30144 pts/0    R+     0:00 ps -axr

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

●Show only the status of a specific process

The ps command normally displays all processes, but it can also be used to display specific processes.
To do so, run the ps command with the option "-C".
Also, if you know the PID (Process ID), you can specify the PID as an argument to display only the status of a specific process.。

root@Lion:~#  ps -lC crond←Show only "crond" processes
F S UID  PID  PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
5 S  0    1770   1 0 78 0 - 1323 - ? 00:00:00 crond
Copied title and URL