Media Gallery

Storage Usage Checking via CLI

Checking what files takes up all your space on GNU/Linux.

Get a general idea of global system storage usage:
# df -h

Get a general idea of current directory:
# du -h

Get a better recursive idea of a specific parent folder:
# du -h -d 1 /home/username
	^ Adjust -d N for depth into the folder.
	  It's sometimes more clear to dig into a single folder at a time.

Sort by the largest first:
# du -k -d 1 /home/username | sort -hr
	^ Show only the top 10 with piping it further to 'head -n10' 

Use all of the above with grep to filter only the 10 largest MiB,GiB,TiB sized results:
# du -h -d 1 /home/username/ | grep '^[0-9.]\{0,100\}[MGT]' | sort -hr | head -n10

Original Post: Feb 7th, '22 11:31 CET.
Updated: Feb 7th, '22 11:33 CET.

Tags: GNU/Linux