Andrew's Blfog

Finding Large Files (on Linux)

If you've ever needed to figure out what files are taking up all the space on your Linux system, you can use this snippet to do so!

sudo find / -type f -printf "%s\t%p\n" 2>/dev/null | sort -nr | head -n 20

This lists the 20 largest files on your system. You can increase the 20 at the end to increase the amount of results.

For a (probably) more useful view, you'd probably want to use something akin to WinDirStat. My utility of choice is WizTree which is SUPER fast because it will scan the file table instead of asking the OS to tell it what's in a directory and recursing. The results are clear, though you do miss out on this extreme speed when using it on a non-NTFS drive.

Alternatives for Linux:

  • qDirStat (graphical)
  • Baobab (graphical)
  • NCDU (usable entirely in a terminal, no gui required)

Out of that list, I've only used NCDU, but it does the job really quite well for being a terminal-based program.

Read More...