You can use the command to check the 10 processes with the most memory
View the most CPU-intensive processes
PS Aux|head-1;ps aux|grep-v pid|sort-rn-k +3|head
or top (then press m, note that this is uppercase)
To view the most memory-intensive processes
PS Aux|head-1;ps aux|grep-v pid|sort-rn-k +4|head
or top (then press p, note this is uppercase)
The command combination is actually the following two sentences:
PS Aux|head-1
PS Aux|grep-v pid|sort-rn-k +3|head
The first sentence is mainly to get the title (USER PID%cpu%mem VSZ RSS TTY STAT START time COMMAND).
The next grep-v PID is to remove the title from the PS aux command, that is, grep does not contain the three-letter combination of the PID line, and then the result is sorted using sort.
Sort-rn-k +3 The R representation of the-RN in this command is the result in reverse order, n is sorted by numeric size, and-K +3 is sorted for the contents of column 3rd, then the first 10 rows of data are obtained by using the Head command. (Of which | represents a pipe operation)
Add: Content Explanation
PID: ID of the process
USER: Process Owner
PR: The priority of the process, the smaller the more priority is executed
Ninice: Value
Virt: Virtual memory consumed by the process
RES: The physical memory consumed by the process
SHR: Shared memory used by processes
S: The state of the process. s for hibernation, R for running, Z for zombie state, n for negative process priority
%CPU: Process Utilization CPU usage
%mem: Percentage of physical memory and total memory used by the process
Time+: The total CPU time that is consumed by the process after it is started, that is, the cumulative value of CPU usage time.
Command: Process Start command name