Home >Operation and Maintenance >Linux Operation and Maintenance >What is the command to view processes in linux?

What is the command to view processes in linux?

藏色散人
藏色散人Original
2020-11-04 15:47:15160020browse

Linux commands to view processes are: 1. PS command, which can check which processes are running and their running status; 2. Top command, which can display the status of each thread in real time; 3. Pstree command, This command displays the derivation relationship between processes in a tree diagram; 4. Pgrep command, etc.

What is the command to view processes in linux?

Recommended: "linux tutorial"

Linux view process command

1. Linux process viewing command: PS command

ps command is a very powerful Linux process viewing command. Use this command to determine which processes are running and running status, whether the process has ended, whether the process is zombie, which processes occupy too many resources, etc. In short, most of the information can be obtained by executing this command.

PS command syntax:

ps [option]

-e displays all processes, environment variables

-ffull format

-h does not display the title

-l long format

-w wide output

-a displays all processes on the terminal, including processes of other users

-r only displays running processes

-x displays processes that do not control the terminal

PS command usage:

ps command is used to view the currently running processes. The most commonly used method is ps aux, and then use the grep command to filter through the pipeline to find a specific process, and then operate on the specific process, in which grep plays a search role.

For example:

ps -ef | grep java

means to view the process information of all processes whose CMD is java

ps -aux | grep java

-aux displays all status

Usually use ps to view the process PID, and use the kill command to terminate the process, such as:

For example :kill -9 [PID]

-9 means forcing the process to stop immediately

2. Linux process viewing command: Top command

top command can Display the status of each thread in real time. To enable thread viewing in top output, call the "-H" option of the top command, which lists all Linux threads. You can also toggle thread view mode on or off by pressing the "H" key while top is running.

What is the command to view processes in linux?

3. Linux process viewing command: Pstree command

The pstree command displays the derivation between processes in the form of a tree diagram relationship, the display effect is more intuitive.

Pstree command syntax:

pstree (option)

-a displays the complete command and parameters -c repeats the process to display respectively -c displays the process ID and PID -n press PID Arrange processes

4. Linux view process command: Pgrep command

The pgrep command searches the process from the running process queue based on the name and displays the found process ID. . Each process ID is represented as a decimal number, separated from the next ID by a delimiter string. The default delimiter string is a new line. For each attribute option, the user can specify a comma-separated set of possible values ​​on the command line.

Pgrep command syntax:

pgrep (option) (parameter)

-l displays the process name and process PID -o process start ID -n process termination ID

The above is the detailed content of What is the command to view processes in linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn