How to Find Large Files in Linux Using the Find Command

When your Linux server or desktop is running out of disk space, the fastest way to reclaim storage is to locate and delete unusually large files (like old backups or massive log files). You can do this quickly from the command line using the find command combined with the -size flag.

Basic Syntax

To find files based on their size, use the following structure:

find /path/to/search -type f -size +[SIZE]
  • -type f: This tells the command to only look for files, ignoring directories.
  • -size +: The plus sign means “larger than.” (Using a minus sign - means “smaller than”).
  • [SIZE]: You use a suffix to denote the size: k (kilobytes), M (megabytes), or G (gigabytes).

Common Examples

1. Find files larger than 100MB

To search your current directory and all subdirectories for files over 100 Megabytes:

find . -type f -size +100M

2. Search the Entire System for files over 1GB

To search the entire hard drive from the root directory (/), you should use sudo to ensure you have permission to search system folders. You should also add 2>/dev/null to the end of the command. This hides all the “Permission denied” errors that normally clutter the screen when searching system paths.

sudo find / -type f -size +1G 2>/dev/null

3. Find Files within a Specific Size Range

You can chain the size arguments together to find files between two specific sizes. For example, to find files larger than 50MB but smaller than 200MB:

find /var/log -type f -size +50M -size -200M

How to View File Details (Size, Permissions)

By default, find only outputs the file path. If you want to see exactly how large the files are, you can tell find to execute the ls -lh command on the results. This provides a human-readable list showing the file size, owner, and date modified.

find / -type f -size +500M -exec ls -lh {} + 2>/dev/null

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.

Receive our best articles and tips delivered straight to your inbox.