[prog] bash script

Wolf Rising wolfrising at gmail.com
Mon Aug 25 15:32:53 UTC 2008


I would like to have a script go thru several computers and check how much
space is being taken up by each user, preferably it would be displayed in
two
columns showing the user's name and space used in GB or MB descending from
most space used to least:

I was using:

for srvr in /usr/center/server1 /usr/center/server2 /usr/center/server3
/usr/center/server4
do
    for usr in $srvr/*
    do
        total=`du -sh $srvr/$usr | awk '{ print $1 }'`
        echo $usr: $total
    done
done

however it does not return the results displayed properly, could anyone
suggest
how to get the script to do so?

It takes quite a while to run as I believe there are several 100gbs to go
thru, if there is
a way to increase speed performance I would be interested in that as well.

Thanks!

<Programming at linuxchix.org>


More information about the Programming mailing list