Last active
June 16, 2020 23:24
-
-
Save tjdahlke/9a4746fd152bce79c2bb24465ea4ed1d to your computer and use it in GitHub Desktop.
A bash script to easily capture memory usage on a linux machine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# ./track_memory.sh 100 | |
# Which will record the memory usage (in Mb) for 100 seconds | |
#!/bin/bash | |
x=1 | |
free -h| grep free > memory.txt | |
while [ $x -le $1 ] | |
do | |
free -m | grep Mem: >> memory.txt | |
echo "$x seconds of tracking memory" | |
x=$(( $x + 1 )) | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment