# Show Partitions 1.0 # Francesco Latini # www.francescolatini.net disk () { DEV=`df | grep /dev | grep -v /dev/mapper | awk {'print $1'}` # devices presents on df NUM_DEVICES=`df | grep /dev | grep -v /dev/mapper | wc -l` # number of devices presents on df HDDTEMP=`which hddtemp 2>/dev/null` # path of hddtemp binary echo -e "\n---- Mounted Partitions ----" for d in $DEV; do device=( "${device[@]}" $DEV ) # create array with devices presents on df done for (( x=0; x<$NUM_DEVICES; x++ )); do for i in ${device[$x]}; do if [ -b "$i" ]; then echo -e "|_ Partitions: `basename $i`" echo -e " \\_" echo -e " |_ Size: `df -h | grep $i | awk {'print $2'}`" echo -e " |_ Used: `df -h | grep $i | awk {'print $3'}` (`df | grep $i | awk {'print $5'}`)" echo -e " |_ Available: `df -h | grep $i | awk {'print $4'}`" echo -e " |_ Mount Point: `df | grep $i | awk {'print $6'}`" echo -e " |_ Filesystem: `mount | grep $i | awk {'print $5'}`" echo -e " |_ Options: `mount | grep $i | awk {'print $6'} | sed {s/[\(\)]//g}`" if [[ -f $HDDTEMP ]]; then # if hddtemp is installed SENSOR=`${HDDTEMP} $i | awk {'print $5$6$7'}` if [ "$SENSOR" = "S.M.A.R.T.notavailable" ]; then echo -e " |_ Temperature: not available" else echo -e " |_ Temperature: `${HDDTEMP} ${device[$x]} | grep /dev | awk {'print $5'}` " fi; else echo -e " |_ Info: install hddtemp for temperature monitoring" fi; echo "" fi; done done }