How to Find Large Files Over a Specific Size in Ubuntu Using the find Command

The Disk Space Crisis

When an Ubuntu Linux server suddenly runs out of hard drive space, the entire system will usually crash. Database services like MySQL will immediately fail to write new records, and you might even be locked out of SSH because the system cannot write to the authentication log. To get the server back online quickly, you need to delete massive files. However, randomly clicking through folders looking for large video files or bloated database backups takes too much time. You must use the terminal to instantly scan the entire filesystem and generate a list of the largest individual files currently sitting on your hard drive.

Using the find Command with -size

The standard Linux find command includes a size filter that allows you to specify exactly how large a file must be to appear in the search results.

  1. Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
  2. Decide where to start the search. To search the entire server, use the root directory (/).
  3. Type the following command to find all files larger than 500 Megabytes:
  4. sudo find / -type f -size +500M
  5. Press Enter and provide your administrator password.

Understanding the Syntax

  • sudo allows the command to look inside restricted system directories like /var/log/.
  • -type f ensures that the command only returns actual files, not massive directories.
  • -size +500M is the critical filter. The + sign is vital; it means “greater than.” The M stands for Megabytes.

Refining the Output

You can easily adjust the parameters. To search for truly massive files over 2 Gigabytes, you would use -size +2G. If the resulting list is too messy, you can pipe the output into the ls command to display the exact file sizes in a readable format right next to the file names:

  1. sudo find / -type f -size +500M -exec ls -lh {} +

This will print a beautifully formatted list, allowing you to instantly identify and delete the exact log file or backup archive that is choking your server.

Get the best tech tips delivered straight to your inbox.

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