Linux viewing processes that occupy the highest CPU
PS Aux|head-1;ps aux|grep-v pid|sort-rn-k +3|head |
or top (then press m, note that this is uppercase)
Linux 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 that this is uppercase)
This combination of commands is actually the following two lines of command:
PS Aux|head-1ps aux|grep-v pid|sort-rn-k +3|head |
The first sentence is primarily 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 of 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-rn R in this command is ordered in reverse order, n is sorted by numeric size, and-K +3 is sorted for the contents of column 3rd, and the first 10 rows of data are obtained by using the Head command. (where | represents a pipeline operation)
Linux view the most memory-intensive/cpu process situation