View the Linux process (ps)

ps: Select the process running status at a certain point in time

Please reprint from the source: http://eksliang.iteye.com/admin/blogs/2119469

http://eksliang.iteye.com

        The man page of the ps command is not easy to read, because many different Unixes use ps to check the status of the process. In order to meet the needs of different versions, this man page is very large. So generally I choose to remember two naming combinations, one is "ps -l" to view the process of your own bash program, and "ps aux" to view the process of the system running the program

   ps -l only view your own bash-related processes

[root@localhost test]# ps -l
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S     0  2175  2171  0  80   0 -  1315 -      pts/0    00:00:00 bash
0 S     0  2212     1  0  80   0 - 190946 -     pts/0    00:00:53 java
4 R 0 6991 2175 0 80 0 - 1219 - pts/0 00:00:00 ps

   The meaning of each column:

   F : Represents the process flag, indicating the permissions of this process. Common numbers are

   1. If it is 4, it means that the permission of this process is root.

   2. If it is 0, it means that this child process can only be copied and cannot be actually executed

   S : Represents the state of the process, the main states are

1. R (running): The process is in progress.

2. S (sleep): The process is currently sleeping, but can be woken up.

3. D: Sleep state that cannot be woken up, usually the process may be waiting for I/O

4. T (stop): stop state, it may be background pause (Ctrl+Z), or execution error

5. Z (zombie): "zombie state", the process has terminated but cannot be deleted out of memory

   UID , PID, PPID: respectively indicate that the process is owned by UID, the PID number of the process, and the PID number of the parent process of this process.

  C : Represents the CPU usage in percentage.

  PRI, NI : Represents the priority of the process being executed by the CPU. The smaller the number, the faster the process is executed by the CPU.

  SZ : Represents how much memory is used by this process.

  TIME : The CPU time used, note that it is the running time that the eating process actually spends on the CPU, not the system time.

  CMD : What is the command that triggered the process.

 

View all processes in the system: ps aux

[root@localhost test]# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1   2900  1444 ?        Ss   Dec14   0:01 /sbin/init
root         2  0.0  0.0      0     0 ?        S    Dec14   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Dec14   0:00 [migration/0]
root         4  0.0  0.0      0     0 ?        S    Dec14   0:00 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S    Dec14   0:00 [migration/0]
root         6  0.0  0.0      0     0 ?        S    Dec14   0:00 [watchdog/0]
root         7  0.0  0.0      0     0 ?        S    Dec14   0:01 [events/0]
.......!

 

 It can be found from the above that the items displayed by ps -l and ps aux are not the same! In the project displayed by ps aux, the meaning of each field is as follows:

USER : which user the process was created by;

PID : the identifier of the process process;

%CPU : The percentage of CPU used by the process;

%MEM : The percentage of physical memory occupied by the process;

VSZ : The amount of virtual memory (KB) used by the process;

RSS : The fixed amount of memory (KB) occupied by the process;

TTY : Which terminal is the process running on, if it has nothing to do with the terminal, it will be displayed? , tty1~tty6 is the login program on the machine, if it is pts/0, it means the process connected to the host by the network.

STAT : The current state of the process, which is the same as the S flag of ps -l (R/S/T/Z);

START : the time when the process was triggered to start;

TIMe : The running time that the process actually uses the CPU;

COMMAND : The actual command of the process; 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326412491&siteId=291194637