The PS command is used to view the process that the system is running
-A shows all processes (equivalent to-e) (utility)-a displays all processes for a terminal, except session leader-N ignores selection. -D displays all processes, but omits all session leaders (utility)-X to display a process that does not control the terminal, and displays the specific path of each command. DX cannot be combined. (utility)-p PID process uses CPU time-u uid or username to select a valid user ID or a user name-G gid or groupname to display all processes of the group. U username Displays all processes under the user, and displays the detailed path of each command. such as: PS U Zhang; (utility)-F all listed, usually associated with other options. such as: Ps-fa or PS-FX and so on.-l long format (with fields such as F,wchan,c)-j job Format-o user-defined format. V Display in the virtual memory format s in signal format-m shows all threads-H displays the level of the process (and other commands, such as: ps-ha) (utility) e command after the display environment (such as: ps-d E; Ps-a e) (utility) H does not display the first line
Common commands
1 View all Processes Ps-ef PS aux2 shows the process of the user by using the "-u" option followed by the user name to filter the user's process. Multiple user names can be separated by commas. ps-f-U www 3. by name or process ID , the process is searched through the "-C" option followed by a name or command. ps-c nginx to display the process through the process ID, use the "-P" option, and you can also specify multiple process IDs by separating them with commas. ps-f-P "-C" must provide an exact process name, and it cannot be found by partial names or wildcard characters. For more flexibility in searching the list of processes, the grep command is typically used. ps-ef | grep nginx4. Using the sort process through CPU or memory system administrators typically want to identify processes that consume the most memory or CPU. The sort option sorts the list of processes based on a specific field or parameter. Multiple fields can be specified with '--sort ' and separated by commas. In addition, the field can be preceded by a '-' or ' + ' prefix to indicate the descending and ascending sort accordingly. There are a lot of options for sorting, with the man page to get the complete list. PS aux--sort=-pcpu,+pmem shows the top 5 CPU-consuming processes. PS aux--sort=-pcpu | head-5
Reference website http://www.binarytides.com/linux-ps-command/
Linux PS command