Categories
guides

Disk Usage of the current folder (du command)

I use du -h --max-depth=1 all the time to determine the disk usage of the folders in my current directory, but my fingers always stumble over --max-depth=.

The better way (which I learned thanks to explainshell.com):

du -hd 1

Some helpful variants:

# uses the Summarize flag to achieve something similar
# different though because it shows individual files (and sizes) at the current working directory, and does _not_ show hidden files or folders

du -hs *
# sorts asc by reported size

du -hd 1 | sort -h
# sorts asc by reported size, and excludes hidden folders

du -hd 1 | sort -h | grep -v "./\\."

By bo.

I'm @boyEatsSteak in a lot of places. I have been wanting 🍕 for weeks. I like gadgets and technology and keeping notes and tips for my future self since all I can remember is that I forget things.