Easily Find Largest Files in Linux

Wondering How to find largest files in Linux so that you can perform a disk cleanup? Perhaps you are running out of disk space? It is always a good idea to keep tabs on your overall file space usage and be aware of which files and directories are taking up the most space on your Linux system. Especially after you’ve installed a lot of software and your disk space begins to fill up.

Once you know what the largest files are, you can perform a disk cleanup to remove any unnecessary files in order to make space for new programs and files.

How to Find Large Files Linux for Disk Cleanup

Here’s one way from Ubuntu Linux to find large files using the find + disk usage (du) + head commands from a terminal.

  1. Open up a terminal Ctrl+Alt+T
  2. Next, type cd and then press Enter to change directory to where you would like to start your base search for the largest files.
  3. Type the following and then press Enter;
    find -type f -exec du -h {} + | sort -hr | head -8

    Linux find large files

The files are located and sorted by largest file size first and then displayed in the terminal window.

How Find + DU + Head work to Locate Largest Files in Linux

The Find command works by first finding all files starting at the base directory including its sub-folders. The files are then probed for their disk usage via du, set to display size in -h (human readable format). The files are then sorted in -h (human readable format) in -r (reverse order) largest first. Finally head is run to output the number of results (-#) , in lines that we want to return. In this example 8.

Note: You will get permission denied errors, if the user running the command doesn’t have permission to access a file.

This concludes the simple tutorial to Find Linux Largest Files.