Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Script to show space usage by users in home partition

by chargrill (Parson)
on Jan 12, 2007 at 08:11 UTC ( #594325=note: print w/replies, xml ) Need Help??


in reply to Script to show space usage by users in home partition

TIMTOWTDI and all, but I'd just parse the output of:

# most linuxes ship with du that has --max-depth $ du -h --max-depth 1 /home # OR *bsds ship with du that has -d $ du -h -d 1 /home

... and look for likely offenders by grepping for high values of M or just G, i.e. output from above on my system:

518K /usr/home/colette 7.5M /usr/home/uvnet 74M /usr/home/dsia 1.3G /usr/home/kcowgill 4.0K /usr/home/kimc

At least you don't have to do a lot of work that du can do for you - which is more portable (installed on every *nix) than dhog (?) which I've honestly never heard of before.

As the output of du with the -h (human readable) flag (along with some kind of depth flag) is easily readable, implementation is left as an exercise for the, uh ... reader. :-)



--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

Replies are listed 'Best First'.
Re^2: Script to show space usage by users in home partition
by klekker (Pilgrim) on Jan 12, 2007 at 09:18 UTC
    I use at work a loop over the home directories and 'du', too. Thats
    ... ($users{uid}) = `/usr/bin/du -s0 --block-size=1048576 $uid ` =~ /^(\d* +)/; ...
    And %users contains the "wasted" space in MB. Additionally I "nice" the process.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://594325]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (13)
As of 2019-09-19 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (243 votes). Check out past polls.

    Notices?