#!/bin/sh # ds Daniel Brockman 20101001 Disk space consumption, hogs first # usage: ds [ dir ] # # Shows the disk space consumed by files and subdirectories, # displaying the ten largest. # # MEME=`basename ${0}` dir=. if [ ${1}x != x ] ; then dir=${1} if [ ! -d $dir ] ; then echo ${MEME}: ERROR: dir $dir not found >&2 exit 1 else cd ${dir} if [ $? -ne 0 ] ; then echo ${MEME}: ERROR: cant cd to $dir >&2 exit 1 fi # $? ne 0 fi # ! d dir fi # 1x != x du -krsx `ls -d * .* | egrep -v '^.$' | egrep -v '^..$' ` \ | sort -nr \ | head -10 #