1 #!/bin/bash
  2 SumMem=0
  3 for i in `ps aux | awk '{print $6}' | grep -v "RSS"`;do        #循环ps aux列出的所有列的次数
  4         SumMem=$(($SumMem+$i))
  5 done
  6 SumMem=$(($SumMem/1024))                                     #将单位以M显示
  7 echo "The all SumMem are ${SumMem}M"
~