This article was co-authored by Michael Thompson-Brown
and by wikiHow staff writer, Nicole Levine, MFA
. Michael Thompson-Brown is a Cybersecurity Expert based in Portland, Maine. He is the owner and founder of PCRescue!, a company that provides cybersecurity and data management solutions to small businesses and individuals. Michael has over 25 years of experience in the IT industry and is a certified ethical hacker. He is passionate about helping clients protect their data and systems from malicious attacks and helping them optimize their online presence and reach. He received a Master’s degree in Cybersecurity and Information Assurance from Western Governors University, and a Bachelor’s degree in Business Administration from the University of Phoenix.
This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources.
This article has been viewed 10,366 times.
If you want to know which files on your Linux system are taking up the most space, you have several options, including both command-line and GUI tools. This wikiHow article will teach you the best ways to find large files on Linux.
Things You Should Know
- To find large files on Linux, use this command: sudo du -aBm / 2>/dev/null | sort -nr | head -n 10
- To find the largest files in a directory, use: du -ah /directory/name | sort -rn | head -n 10
- To find all files over 500 MB, use: sudo find / -type f -size +500M -ls
Steps
Using the du Command
-
1Find the largest files in a directory. To see the top 10 largest files and their sizes in a directory, use du -ah /directory/name .
- To find the largest files in the current directory, omit the directory name from the command.
- You can replace -10 after head -n with your preferred number of large files to display.
-
2Find the largest files on the entire system. To see the ten largest files on your Linux system, use sudo du -aBm / 2>/dev/null .
- Because you're finding the largest files in all directories, you'll need to use the sudo command to get root privileges .
- This command can take a long time to run, as it needs to search all files on the system.
Using the find Command
-
1Find large files in a directory. To find the 10 largest files in a directory, use find /directory/name -type f -exec ls -sh {} \; .
- This command displays the ten largest files in the current directory and their sizes, with the largest file at the top of the list. You can replace 10 with your preferred number of files, such as 20 to see the 20 largest files.
- To find the largest files in the current directory, omit the directory name or replace it with . .
-
2Find files above a specific size in a directory. To find all large files above 500 MB in a directory, use find /directory/name -type f -size +500M .
- Replace 500M with your preferred file size.
- To search the current directory, replace the directory name with . .
-
3Find all the large files on your entire Linux system. To find all files above a certain size on the entire filesystem, use sudo find / -type f -size +500M -ls . In this command, only files larger than 500 MB will appear in the results, along with their size, owner, and permissions.
Using the df Command
Using GUI Apps
-
1Filelight. This KDE app, which is available from Ubuntu Software (or use sudo apt install filelight at the prompt), makes it easy to find large files in Linux. It also displays the large files as a nice visual so you can get an idea of how your storage is being used. [1] X Research source
-
2QDirStat. Another great GUI tool that will help you find and visualize large files on Linux is QDirStat, which you can install using the command sudo apt install qdirstat (Debian, Linux Mint, and Ubuntu) or sudo dnf install qdirstat (Fedora and Redhat). Once installed, select any directory, including the root directory, to find large files.
Expert Q&A
Video
Tips
- You can also use ncdu , a disk usage analyzer meant for finding large files on remote servers. Install it with sudo apt install ncdu , or get it from your distro's package manager. [2] X Research sourceThanks
You Might Also Like
Expert Interview
Thanks for reading our article! If you’d like to learn more about linux, check out our in-depth interview with Michael Thompson-Brown .