Shell Tricks #3 - Disk Usage Alarm

This is a one-liner to “alarm” if the disk usage of a filesystem has exceeded a certain threshold. I put the directory to monitor as “~” (home) and the threshold as 40%.

test `df -h ~ | grep -o '[0-9]*%' | grep -o '[0-9]*'` -ge 40 && echo high
    . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

    Leave a Reply


    Bad Behavior has blocked 144 access attempts in the last 7 days.