Display disk space, available and space used

Published on April 01, 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"

Related Posts

If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.

Disclaimer: Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Published on April 01, 2008