Robert Harker

Authored Comments

The -h flag is new to me. I like it. Try adding this alias to your .bashrc file:
alias du='du -h'

I learned the -s flag for summary rather than the -c flag. Easier to remember.

Some du commands I use:

du -sh *
Summarize disk usage for directories and files in the current directory.

du -sh * | sort -n
Sort the size of the directories or files in the current directory.
-n sorts based on numerical value not alphanumeric. -rn reverse the sort order.

du -sh * | sort -n | tail -5
Show the 5 largest directories or files in the current directory.
This is just a summary of the top level files and directories in the current directory.

find . -type f | xargs -d '\n' du -sh * | sort -n | tail -5
Find the 5 largest files in the current directory.
Useful for finding unexpected huge files you were not aware of.
The -d '\n' argument to xargs tells xargs to break arguments on newlines. It avoids problems with filenames with spaces in them.

du was one of the first UNIX commands I learned 45 years ago. An oldie but goodie.

Somewhat related is the history of UUNET and X11R2. I was working at Fairchild's Palo Alto Research Lab at the time, 1987, as their sysadmin. I had established a paid UUCP connection with UUNET so we could register a domain name, At the Usenix conference X11R2 was announced as stable reliable code after a major rewrite. Developers returning back home wanted to download the code but it was large, 50Mb or so. This was back when 2400 baud was a fast modem. UUNET announced they would have the code available for download for their customers. Lots of organizations signed up for their service so they could get the code. As I recall we had the new Trailblazer 9600 baud modems so it only took a couple of days to download the code.

X11R2 kick started UUNET what I consider the first successful commercial ISP. Lots of companies signed up and registered their first domain name after the release of X11R2.

Ah, just a stroll down memory lane...