Linux Articles, Shell Scripts October 29, 2010 2

Top Memory and CPU consumers UNIX, LINUX

  • Linux OS
#current user: $ ps u USER       
PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND 
user     16038  0.0  0.1   4852   784 pts/0    Ss+  Oct28   0:00 /bin/bash   

#to display the top CPU consumer 
$ ps aux | sort -nk +3 | tail -1     

#to display the top memory consumer 
$ ps aux | sort -nk +4 | tail -1   

#the top 10 (high to low) memory users in the system 
$ ps aux|sort -nk +4|grep -v USER|head -10
  • UNIX OS
# Top 10 processes using the most of CPU: 
$ prstat -s cpu -a -n 10   

# Top 10 processes using the most of Memory: 
$ prstat -s size -n 10   

# Virtual Memory Paging, 5 samples at 5 second intervals  
$ vmstat -S 5 5

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close