Found a nice lil trick

This commit is contained in:
Ethan Edwards 2020-06-07 19:16:55 -04:00
parent 8ba9b20152
commit 167260211a

View file

@ -19,7 +19,7 @@ get_percent()
Darwin)
# percent=$(ps -A -o %mem | awk '{mem += $1} END {print mem}')
used_mem=$(top -l 1 -s 0 | grep PhysMem | awk '{mem += $2} END {print mem}')
total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{mem += $2} END {print mem}')
total_mem=$(system_profiler SPHardwareDataType | grep "Memory:" | awk '{print $2 $3}' | sed 's/used//g')
echo $used_mem/$total_mem\G\B
;;