purl's posterous

« Back to posts
  • Viewed
    times
September 25, 2011

Script to find the root directory usage, on system with lots of mounts

  • Edit
  • Delete
  • Tags
  • Autopost

sudo perl -MList::MoreUtils=any -lne 'BEGIN{@m=map {@F=split; qq(^$F[2])} map {$1 if m{(.*)}} qx{mount|tail --line=+2}; open STDIN, q(find / -maxdepth 3 -mindepth 1 |)} $p=$_; do {print join qq(\t), qx(du -s "$_")=~m{(.*)}} unless any {$p=~m{$_} or $_=~m{$p}} @m' | sort -k1 -nrg | head

Tweet
  • 0 responses
  • Like
  • Comment