Find Large Files in Linux

Want to find large files in Linux? Running out of disk space and need to perform a cleanup? It's always a good idea to keep tabs on your file space usage and know which files and directories are taking up the most room, especially after installing a lot of software. Once you know the largest files, you can delete or move unnecessary ones to free up space.

List Files by Size in Linux

List Files by Size Linux

You can list the contents of the current directory by size (largest first) using:

ls -Ssh

-S sorts by file size, -s shows size, and -h makes it human-readable.

Find Large Files in Using the find Command

To locate files larger than 100 GB in the current directory and subdirectories:

  1. Open a terminal (Ctrl+Alt+T).
  2. Navigate to your search base:
    cd /path/to/start
  3. Run:
    find . -type f -size +100G

This searches for regular files (-type f) larger than 100 GB (-size +100G) starting from the current directory (.).

Remove Large Files in Linux

Warning: This will permanently delete files without confirmation. Double-check before running!

find . -type f -size +100G -exec rm {} +

Here, -exec rm {} + runs rm on each file found, grouping them for efficiency.

Find Largest Files Using find + du + head

  1. Change to your desired base directory.
  2. Run:
    find . -type f -exec du -h {} + | sort -hr | head -8

 

find large files linux

This finds all files, measures disk usage in human-readable format, sorts from largest to smallest, and displays the top 8.

How It Works

  • find, locates all files from the base directory down.
  • du -h, shows file sizes in human-readable format.
  • sort -hr, sorts by size, largest first.
  • head -8, shows only the top 8 results.

Note: You may see "Permission denied" errors if your user does not have rights to certain files.

And that's it, now you know several ways to find large files in Linux and manage them to help keep your system tidy.