Skip to content

Instantly share code, notes, and snippets.

@raidzero
Created March 5, 2014 23:49
Show Gist options
  • Save raidzero/9379225 to your computer and use it in GitHub Desktop.
Save raidzero/9379225 to your computer and use it in GitHub Desktop.
Record highest amount of ram (in bytes) used at once on a system
#!/bin/bash
maxRAM=0
prevMax=0
while [ 1 == 1 ]; do
initRAM=`free | grep "Mem:" | awk '{print$3}'`
freeRAM=`free | grep "Mem:" | awk '{print$3}'`
if [ $freeRAM -ge $initRAM ]; then
prevMAX=$freeRAM
if [ $freeRAM -ge $maxRAM ]; then
maxRAM=$freeRAM
if [ $maxRAM -ge $prevMax ]; then
clear && echo "Maximum: $maxRAM"
fi
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment