This option combination will display the process information of each user. using these options without the prefix will enable the command to run in "BSD" mode
Introduction
The ps command has many options. the simplest format is as follows:
[Allyes_op @ allyes ~] $ Ps
PID TTY TIME CMD
1079 pts/2 00:00:00 bash
1114 pts/2 00:00:00 ps
In this example, the two processes correspond to the bash and ps commands respectively.
By default, the output information of ps commands is not many, but the process information related to the current session terminal is output.
Before introducing other options of the ps command, let's take a look at other fields output by the ps command:
TTY: indicates the control terminal of the process.
TIME: indicates the total cpu time consumed by the process.
========================================================== ========================
Ps x
Adding the x option will tell the ps command to display all processes without worrying about which terminal they are controlled.
The output result adds a new column named STAT, which displays the current state of the process.
========================================================== ========================
STAT status
R |
Running status. The process is running or is ready to run. |
S |
Sleep status. The process is not running, but waiting for an event, such as inputting a keyboard or receiving a network packet. |
D |
Uninterrupted sleep status. Processes are waiting for I/O operations, such as hard drive |
T |
Paused. The process is instructed to be paused. |
Z |
Invalid or zombie process. |
< |
High-priority process. Processes can be assigned more importance and more CPU time. |
N |
Low-priority process. The time to use the processor can be obtained only after other higher-priority processes use the processor. |
========================================================== ========================
Ps aux
Another common option combination is aux.
This option combination will display the process information of each user. using these options without the prefix will enable the command to run in "BSD" mode.
========================================================== ========================
BSD mode field information
USER |
User ID |
% CPU |
CPU usage percentage |
% MEM |
Memory usage percentage |
VSZ |
Virtual memory consumption size |
RSS |
Actual memory size, in kb |
START |
Process start time. If the value exceeds 24 hours, the date is used for display. |
========================================================== ========================