#!/bin/bash # Kyle Christensen # (KrON@EFnet) # mute@snip.net # Partially Stolen from cracksmoking da5id # Mad Props to NinjaCodr For debugging / learning me in bash ;) # Greets to twiztah too, who was the one who brought to my attention # the tmpraces in the old one.. # Despite recent events i still luff him :P # # Installation: # cp fd /bin/ # and in your ~/.bashrc -> alias df="fd" # # Note: I excluded cdrom's from the totals.. It's sorta pointless.. # Also this is made for ext2 cuz its based on 1024 cylinders.. # On Digital Unix you could replace size=1024 to size=512 # # 1/15/99: Hacked in 'human readable' summaries at the bottom! # Please mail me if its messed up, I only have gigs free so it's hard to tell ;) # 3/16/00 Be sure to peep line 64 to check the excluded filesystem types # devpts=1 count=1 size=1024 total1=0 total2=0 total3=0 prog="df -Pxshm" for amt1 in `$prog |grep -v Used | grep % | awk '{print $2}'` do total1=`expr $amt1 + $total1` done for amt2 in `$prog |grep -v Used | grep % | awk '{print $3}'` do total2=`expr $amt2 + $total2` done for amt3 in `$prog |grep -v Used | grep % | awk '{print $4}'` do total3=`expr $amt3 + $total3` done total1=`expr $total1 / $size` total2=`expr $total2 / $size` total3=`expr $total3 / $size` while [ $count -lt 4 ] do total=\$total${count} tmp=`eval echo $total` if [ $tmp -ge 1024 ]; then tmp=`expr $tmp / 1024`.`expr $tmp \* 10 / 1024 % 10` eval "total${count}=${tmp}G" elif [ $tmp -ge 1 ]; then eval "total${count}=${tmp}M" else eval "total${count}=${tmp}K" fi count=`expr $count + 1` done echo "" $prog -mTh -x iso9660 -x proc -x shm -x devpts echo "" echo " Total: $total1 Used: $total2 Free: $total3" echo ""