Note: You are viewing an old version of this page. View the current version.

Compute a sorted disk usage analysis using du, without including filesystem mountpoints

duso() {
sudo sh -e <<"EOF"
mnt="$(stat -c %m .)"
LANG=C ls -1a | grep -Gv '^\.$\|^\.\.$' | while read dent
do
  [ "$(stat -c %m "${dent}")" = "${mnt}" ] || continue
  printf "%s\0" "${dent}"
done | xargs -0 du -sx | sort -bn
EOF
}