Skip to content

Instantly share code, notes, and snippets.

@craigcalef
Created October 2, 2019 20:40
Show Gist options
  • Save craigcalef/8a37ff41134339c5aec4bca45e331580 to your computer and use it in GitHub Desktop.
Save craigcalef/8a37ff41134339c5aec4bca45e331580 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Shame people using too much disk. Good for your /etc/update-motd.d
# Lol what is this the 90s?
PCENT=$(df --output=pcent /home | tr -dc '0-9')
if (( $PCENT > 90 )); then
echo -e "\033[5mDisk usage has exceeded 90%\033[0m"
df -h /home
fi
du -ks /home/* | sort -n | awk '{ if ($1 > 2000000000) print $2 " is using " $1 / 1000000000 " Tb of disk space" }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment