View most CPU-memory processes under linux
1.CPU take up the top 10 processes:
ps auxw|head -1;ps auxw|sort -rn -k3|head -10
2. Memory consumption before 10 process most
ps auxw|head -1;ps auxw|sort -rn -k4|head -10
3. Virtual memory usage up to the top 10 processes
ps auxw|head -1;ps auxw|sort -rn -k5|head -10
ps auxw
u: user-based format to display program status
x: Show all programs, not to the terminal to distinguish
w: using wide format display program status
auxw PS | head -1 output meters
Tail 10 before output head -10
sort -rn -k5
sort -n is in numerical size, -r in reverse order, -k is specified fields to be sorted
The USER // username 1 ------------------ % the CPU // the CPU percentage occupied by the process ---------------- 2 MEM% // percentage ------------------- 3 memory-intensive VSZ // amount of virtual memory used by the process (KB) --------- --4 RSS // fixed amount of memory consumed by this process (KB) Resident size ----------- 5 the SET STAT // status of the process ------------- 6 the sTART // the process is triggered start time 7 -------------- the tIME // the actual process of using the CPU running time ------------ 8
The results of the x parameter removed
ps auw | head -1; ps auw|sort -rn -k4 | head -10
PID : Process ID of the USER : Process owners PR : priority process, the smaller the priority is executed NInice : Value VIRT : virtual memory occupied by the process RES : process takes physical memory SHR : process uses shared memory S : Process status. S indicates sleep, R represents a running, Z represents a dead state, N is negative indicates that the process priority % CPU : process CPU utilization % MEM : percentage of physical memory and total memory used by the process of the TIME + : This process is started the total CPU time after the occupation, namely the use of CPU time accumulated value. The COMMAND : command name of the process started
================================================================================================================
Gets occupation under Linux the CPU resources up to 10 process, you can use the following command combinations:
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head
obtaining occupancy under linux memory resources up to 10 process, you can use the following command combinations:
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head
Command parsing combination (for the CPU, MEN also the same reason):
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head
This command is actually a combination of the following two commands:
ps aux|head -1 ps aux|grep -v PID|sort -rn -k +3|head
You can use the following command to check the use of up to 10 memory process
View the highest process takes cpu
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +3|head
Or top (press M , attention here is capitalized)
View occupy the highest memory process
ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head
Or top (press P , attention here is capitalized)
This command is actually a combination of the following two commands:
ps aux|head -1 ps aux|grep -v PID|sort -rn -k +3|head
In which the first sentence ( PS the AUX | head -1 ) primarily to obtain the title (USER PID% CPU% MEM VSZ RSS TTY STAT START TIME COMMAND).
The next grep -v PID is obtained the title command ps aux removed, i.e. grep PID does not include letter combinations of these three lines, and then using the results of which sort ordering .
sort -rn -k +3 in the command r -rn represents the result of the reverse order, as the n-sorting numerical size, and -k +3 content is sorted for the third column, then use the command to obtain a default head the first 10 rows of data. (Where | a piping operation)