How to Find Files by Specific Size in Ubuntu Linux (find -size)

The Disk Space Crisis

When an Ubuntu Linux server suddenly runs out of disk space, the culprit is usually a single, massive log file or a bloated database dump. Finding the exact file responsible for the storage crisis manually is like finding a needle in a haystack. You cannot simply list all the files on the server, as there are millions of them. Instead, you must instruct the Linux search engine to filter the entire filesystem based strictly on the physical size of the files, allowing you to instantly isolate the largest data hogs.

Using the find Command with -size

The Linux find command utilizes the -size flag to mathematically filter results based on megabytes (M), gigabytes (G), or kilobytes (k).

  1. Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
  2. To scan the entire server (/) and exclusively list files that are strictly larger than 500 Megabytes, type the following command exactly:
  3. sudo find / -type f -size +500M
  4. Press Enter and provide your administrator password.

Targeting Specific Ranges

The syntax for the size flag uses a plus (+) to mean “larger than” or a minus (-) to mean “smaller than.” You can combine these flags to find files that fall within a highly specific range. For example, running sudo find /var/log/ -type f -size +1G -size -5G will instruct the search engine to look in the log directory and only return files that are larger than 1 Gigabyte but strictly smaller than 5 Gigabytes. This allows you to rapidly pinpoint the exact files you need to compress or delete to restore your server’s health.

Get the best tech tips delivered straight to your inbox.

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