Skip to content

Instantly share code, notes, and snippets.

@developerck
Last active August 30, 2021 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save developerck/0dac67ecaf9abd4e8844c105f15ab56f to your computer and use it in GitHub Desktop.
Save developerck/0dac67ecaf9abd4e8844c105f15ab56f to your computer and use it in GitHub Desktop.
show the disk usage
#!/bin/sh
df -Ph | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5,$1 }' | while read output;
do
max=40%
echo $output
used=$(echo $output | awk '{print $1}')
partition=$(echo $output | awk '{print $2}')
if [ ${used%?} -ge ${max%?} ]; then
echo "The partition \"$partition\" on $(hostname) has used $used at $(date)"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment