Display disk space, available and space used
Published on 01 April 2008
This shell script displays the total available disk space and space used.
#!/usr/bin/bash
# Displays disk space [total available space, space used]
# Arul John
total=0
for i in `df -k | tail +2 | awk '{print $2}'`
do
total=`expr $total + $i`
done
echo "$total"
total=0
for i in `df -k | tail +2 | awk '{print $3}'`
do
total=`expr $total + $i`
done
echo "$total"
Created on 01 April 2008
Affiliate Disclosure: Some of the links to products on this blog are affiliate links. It simply means, at no additional cost to you, we’ll earn a commission if you click through and buy any product.