Last active
May 3, 2023 19:24
-
-
Save egulhan/61c41558fc523a8c7d7fb4603b772f3b to your computer and use it in GitHub Desktop.
echos memory, disk and cpu usage
This file contains 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
printf "Memory\t\tDisk\t\tCPU\n" | |
MEMORY=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }') | |
DISK=$(df -h | awk '$NF=="/"{printf "%s\t\t", $5}') | |
CPU=$(top -bn1 | grep load | awk '{printf "%.2f%%\t\t\n", $(NF-2)}') | |
echo "$MEMORY\t$DISK\t$CPU" |
This file contains 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
watch -n5 stats.sh >> stats.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment