Skip to main content

Posts

Showing posts from January 27, 2013

Find the 10 largest directories on POSIX

This script outputs the number of 1,024 byte blocks consumed by each of the 10 largest directories in the provided directory, or in the current directory if no arguments are provided. From: Warren Young Date: Wed, 30 Jan 2013 21:08:33 -0700 "This script helps me find the 10 biggest pigs on any system with a basic POSIX user environment." #!/bin/sh if [ $# -eq 0 ] then     dir=. else     if [ ! -d $1 ]     then         echo usage: $0 [directory] [options]         echo         echo "  Prints kb in use in directory; if directory isn't"         echo "  given, '.' is assumed."         echo         echo "  If you give options, they are passed to du, in addition"         echo "  to the -sk options the script provides."         echo    ...