Saturday, September 29, 2012

Linux Commands to Monitor Memory usage

1) vmstat: Monitor virtual memory
    Commands
    ----------------------
      vmstat
      vmstat -s -S M

2) top command

3)pmap Display/examine memory map and libraries (so). Usage: pmap pid

4)sar -B Show statistics on page swapping.

5) time -v date Show system page size, page faults, etc of a process during execution. Note you must fully qualify the command as "/usr/bin/time" to avoid using the bash shell command "time".

6)free Display amount of free and used memory in the system.

7)ps aux

To see only the memory resources occupied by each category of processes, such as Apache httpd, MySQL mysqld or Java, use the following command:

ps aux | awk '{print $4"\t"$11}' | sort | uniq -c | awk '{print $2" "$1" "$3}' | sort -nr