Skip to content

Instantly share code, notes, and snippets.

@zxt5105515
Created August 3, 2023 06:14
Show Gist options
  • Save zxt5105515/a28f57bb813829504035654f635c9903 to your computer and use it in GitHub Desktop.
Save zxt5105515/a28f57bb813829504035654f635c9903 to your computer and use it in GitHub Desktop.
get disk free space in gigabytes
diskFree=`df -g / |sed -n '2p'|awk '{print $4}'`
echo "diskFree :$diskFree"
if ((diskFree<5)); then
echo "warning, disk is less then 5GB! please check your disk!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment