-bash-3.1$ pmap -x 2401|grep 'total'>tmpfile ##查看进程2401占用的内存大小,且写入到tmpfile文件中
-bash-3.1$ cat tmpfile |awk '{sum+=$3;} END {print sum}' ##查看tmpfile文件第三列累计值
-bash-3.1$ more tmpfile
total kB 4280 - - -
total kB 4280 - - -
-bash-3.1$ cat tmpfile |awk '{sum+=$3;} END {print sum}' ##为第三列累计值,所以是8560
8560
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-669810/ ,如需转载,请注明出处,否则将追究法律责任。