Code: Select all
# df
Code: Select all
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda3 78012484 17606992 56442660 24% /
/dev/hda1 101086 16400 79467 18% /boot
none 516808 0 516808 0% /dev/shm
/tmp 247919 7339 227780 4% /tmp
Code: Select all
# df -h
Code: Select all
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 75G 17G 54G 24% /
/dev/hda1 99M 17M 78M 18% /boot
none 505M 0 505M 0% /dev/shm
/tmp 243M 7.2M 223M 4% /tmp
Code: Select all
#!/bin/sh
Code: Select all
DISC=$1
PARTITION=`df -h |grep $DISC |awk ‘{print $1}’`
SIZE=`df -h|grep $DISC|awk ‘{print $2}’`
USED=`df -h|grep $DISC|awk ‘{print $3}’`
FREE=`df -h|grep $DISC|awk ‘{print $4}’`
echo “Partition: $PARTITION”
echo “Total size: $SIZE”
echo “Used space: $USED”
echo “Free space: $FREE”
Code: Select all
# chmod +x info.sh
Code: Select all
# ./info.sh hda3