Free Disk Space in Bash

Returns free disk space:

df | egrep '/$' | awk '{print $4}'

Returns free disk space in human readable form like  K.M or G:

df -h | egrep '/$' | awk '{print $4}'

Returns the used Percentage as value  :

df -h | egrep '/$' | awk '{print 100-$5}'

with Percentage character use :

df -h | egrep '/$' | awk '{print 100-$5."%"}'

Leave a Reply

Your email address will not be published.

5 × five =