Total Used and Free Memory in MBytes (in that order)
free -m|grep "buffers/cache"|cut -d":" -f2
Raw
ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS
Human readable
ps -e -orss=,args= | sort -b -k1,1n | awk '{ split( "KB MB GB" , v ); s=1; while( $1>1024 ){ $1/=1024; s++ } print int($1) " " v[s] " " $2 }'
Raw
ps -e -orss=,args= | awk '{arr[$2]+=$1} END {for (i in arr) {print arr[i],i}}' | sort -b -k1,1n
Human readable
ps -e -orss=,args= | awk '{arr[$2]+=$1} END {for (i in arr) {print arr[i],i}}' | sort -b -k1,1n | awk '{ split( "KB MB GB" , v ); s=1; while( $1>1024 ){ $1/=1024; s++ } print int($1) " " v[s] " " $2 }'
ps -e -orss= | awk '{ sum += $1 } END { print sum }'
Human redable
ps -e -orss= | awk '{ sum += $1 } END { print sum }' | awk '{ split( "KB MB GB" , v ); s=1; while( $1>1024 ){ $1/=1024; s++ } print int($1) " " v[s] " " $2 }'
smem -w -t -k
Use lshw
- for listing hardware including physical memory slots