Use the ls Command
Generally, the ls command is used to list all of the directories and files in the Linux terminal. However, it can do much more – for instance, classify directory contents and display file sizes.
Use the find Command
The find command can be used to search any files inside a Linux filesystem. In this case, we can employ it to list files according to their file sizes. We can also filter the results by minimum file size. Note: the -xdev flag instructs not to descend directories on other filesystems. In simple words, it won’t scan other mounted filesystems in your Linux system. Now you should be able to view the list of the largest files in your entire device along with your mounted drives.
Use the du Command
The du command is primarily designed to estimate file sizes in Linux. Here’s how to find large files with it.
Find Large Unused Files
Getting the list of unused files is very useful, as you can readily delete them to save space on your hard disk. Do this with the help of the -mtime flag and the find command discussed earlier. The following instructions will list out the top 10 files, which have not been modified for more than 30 days and have a file size of at least 100MB.
GUI Apps to Find the Largest Files in Linux
If you are running Linux on your desktop, make use of these GUI apps to find the largest files in your system.
Disk Usage Analyzer
One of the best GUI apps to analyze file sizes in Linux is Disk Usage Analyzer. It comes preinstalled in your Gnome desktop environment. For Fedora or other red-hat-based distributions, install Disk Usage Analyzer by using the following command: Some additional GUI apps that you can use to find large files on your Linux system include:
FilelightDucJDiskReportQDirStat
Remove the Largest Files
After finding the largest files, you need to remove them and can easily do so with the help of therm command in Linux. Image source: Unsplash All screenshots Hrishikesh Pathak