Notice: Undefined index: verify_cf7 in /var/www/html/ on line 113
Shell Script to Watch Disk Space | Zack Reed - Design and Coding

Shell Script to Watch Disk Space1 min read

The first step in your fancy Bash script is to get disk space like this.


Next, let’s focus on grabbing the percentage of space used on each device..


Shell Script

Let’s take this info and write a simple shell script. The previous command displays fields 5 and 1 of the df command. Now all you need to do is write a script to see if the percentage of space is >= 90%.

and paste.

Replace with your proper email account. Next, we’ll need to set it up as executable and add it to our cronjobs.

Install as cronjob:

Finally, add this to your cronjob list.

This will make it run at 12:10 A.M. every day. It will automatically email an alert if you’re over 90% used on any one of your volumes.


I love learning new things and trying out the latest technology.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.