D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Low diskspace on /

 

On 13/08/2014 11:42, Mark Williams wrote:
> On 13/08/2014 10:56, Julian Hall wrote:
>> How would I list the directory(ies) sizes on / please?
>
> ncdu isn't bad as a terminal app: http://dev.yorhel.nl/ncdu
>
> Baobab is otherwise good as an app with a GUI:
> http://www.marzocca.net/linux/baobab/
Baobab works well but most of the time I don't have a GUI on the server.
I'll have to take a look at ncdu. Most of the time I just use du and
some hacky Perl regex to produce the numbers I need.

perl -n -e '$grp="' -e "$grep_string" -e
'";$lvl=$grp=~tr[/][];$lvl++;print  if
/^(\d+)(\s*)[^\/]+(\/[^\/]+){$lvl}[^\/]*$/;' < $file | grep $grep_string
|sort -n

where $file is the output from "du -m" and $grep_string is the directory
path you want to summarize.

It's probably not the best way to do it but it evolved from a previous
regex and it worked so I never bothered trying to make it pretty.

Cheers,

Pete




-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq