#!/bin/bash

( [ -z "$1" ] || [ "$1" == "-h" ] ) && echo "Usage: $0 (target dir) [# tail ines of output]\nShows a sorted du -xm of target, largest at bottom for #tail lines (default 20)" && exit 1

tail=20
echo "$1" | grep -q '^\-' && tail=`echo $1 | tr -d "-"` && shift

du -xm $* | sort -n | tail -n $tail
