How to find the biggest files or directories on Linux

Last updated on July 20, 2020 by Dan Nanni

Question: I want to know which files (or directories) consume the largest disk space on my Linux. What is a command line which finds the biggest files or directories?

When it comes to checking which files or directories waste your disk space the most, du command is probably the easiest way.

To find the biggest files or directories on Linux, use the following command.

$ du -Sh | sort -rh | head -n 15

The above command will sort all files and sub-directories which exist in the current directory in the order of size (biggest size first), and print the top-15.

If you want to find the biggest files only (but not directories), use the following command instead.

$ find . -type f -exec du -Sh {} + | sort -rh | head -n 15

It will print the top-15 biggest files located in the current directory (and its all sub-directories).

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean