The commands to query processes in Linux are: 1. ps command, which displays a snapshot of the currently active process; 2. top command, which displays the processes running in the system and system resource usage in real time; 3. pgrep command, based on Process name or other attributes to find and print the matching process ID; 4. pidof command, find and print the first matching process ID based on the process name.
The operating system of this tutorial: Linux5.18.14 system, Dell G3 computer.
In Linux, to query process information, you can use the following command:
1. ps command: Display a snapshot of the currently active process. Commonly used options are:
#ps aux: Displays all processes for all users.
ps -ef: Display complete information of all processes.
2. Top command: Display the processes running in the system and system resource usage in real time. It sorts processes by CPU usage and updates the display.
3. pgrep command: Find and print the matching process ID based on the process name or other attributes. For example, pgrep ssh will list all process IDs named ssh.
4. pidof command: Find and print the first matching process ID based on the process name. For example, pidof sshd will return the ID of the sshd process.
The above are some common commands for querying processes. You can choose the appropriate command to obtain process information according to your own needs.
The above is the detailed content of What is the command to query processes in linux?. For more information, please follow other related articles on the PHP Chinese website!