Non multa, sed multum!

Now with octopress.

WhatSize in Bash (Fast and Dirty)

| Comments

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

if [ "$1" = "" ]; then
  listlength=10
else
  listlength=$1
fi
du -s * | sort -rn | head -n $listlength \
| sed s/^[0-9]*// | while read item
do 
  if [ "$item" = "" ]; then
      continue
  fi
  echo `du -hs "$item"`
done

Tested on Mac OS X and Ubuntu.