Source:
#! /usr/bin/awk -f
BEGIN {totall=0; totuse=0}
$1 ~ /\/dev\// {totall=totall+$2; totuse=totuse+$3};
END {printf ("\n Total space: %10d \n Total used: %10d\n", totall, totuse);
percentage=((totuse*100)/totall);
print "Percent used: " percentage "%\n"}
Command:
$ df | dfpercent.awk
Example Output:
Total space: 303813577
Total used: 159883625
Percent used: 52.6256%