Get the App
SLTechnology News&Howtos  ›  Servers  › 

Linux Cloud Computing Technology Learning: how to View the process ps

Shulou Source: shulou.com Published: 2022-06-02 06:56:34 10月01日 Update

In order to monitor and control the process, we must first understand the current process, that is, we need to look at the current process, and the ps command is the most basic and powerful process view command. Use this command to determine which processes are running and running status, whether the process ends, whether the process has zombies, which processes take up too many resources, and so on. In short, most of the information can be obtained by executing the command.

The ps command is most commonly used to monitor the work of background processes, because background processes do not communicate with standard input / output devices such as on-screen keyboards, so if you need to detect the situation, you can use the ps command.

1) ps a displays all programs under the current terminal, including those of other users.

2) ps-A shows all programs.

3) when ps c lists programs, it displays the real instruction name of each program, without the path, parameter, or resident service tag.

4) ps-e this parameter has the same effect as specifying the "A" parameter.

5) when ps e lists programs, it displays the environment variables used by each program.

6) ps f displays the tree structure with ASCII characters to express the relationship between programs.

7) ps-H shows a tree structure, indicating the relationship between programs.

8) ps-N displays all programs except those under the ps instruction terminal.

9) ps s displays the status of the program in the format of program signals.

10) when ps S lists the program, it includes the interrupted subroutine data.

11) ps-t specifies the terminal number and lists the status of the programs that belong to the terminal.

12) ps u displays the program status in a user-oriented format.

13) ps x displays all programs, not distinguished by terminals.

The most common method is ps-aux, and then use a pipe symbol to direct to grep to find a specific process, and then operate on a specific process.

There are five states of a process on linux:

1. Run (running or waiting in the run queue)

two。 Interrupt (while dormant, blocked, waiting for the formation of a condition or receiving a signal)

3. Uninterruptible (unawakened and unrunnable upon receipt of the signal, the process must wait until an interruption occurs)

4. Deadlock (the process is terminated, but the process descriptor exists until the parent process calls the wait4 () system call to release)

5. Stop (the process stops running after receiving SIGSTOP, SIGSTP, SIGTIN, SIGTOU signals)

The ps tool identifies five status codes of the process:

D non-interruptible uninterruptible sleep (usually IO)

R runs runnable (on run queue)

S interrupt sleeping

T stop traced or stopped

Z zombie a defunct ("zombie") process

Note: other states include W (no resident pages)

Tags: Process program run command status memory terminal terminal priority signal format user parameter size byte situation condition background common use instruction Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Redmi Microsoft Huawei vpn