The Storage Audit
When an Ubuntu Linux server runs out of hard drive space, the entire system can crash. Finding the exact files responsible for the bloat is critical. While you can use commands like du to analyze directory sizes, you often need to pinpoint individual, massive files (like runaway database dumps or bloated application logs) scattered across the filesystem. To hunt down these storage hogs quickly, you must instruct the Linux search engine to filter files based exclusively on their exact byte size.
Using the find Command with -size
The Linux find command utilizes the highly precise -size flag to isolate files based on their physical footprint on the disk.
- Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
- To scan the entire
/var/directory and return only files that are exactly 10 Megabytes in size, type the following command exactly:sudo find /var/ -type f -size 10M - Press Enter and provide your administrator password.
Targeting Large Files
You can use the plus (+) and minus (-) modifiers to search for size ranges, which is far more useful than searching for exact sizes. For example, if your server is full, running sudo find / -type f -size +1G will scan the entire hard drive and output a list of any file that is larger than 1 Gigabyte. This allows you to instantly identify massive 50GB ISO files or bloated log archives so you can delete them and instantly recover critical storage space. (Use k for Kilobytes, M for Megabytes, and G for Gigabytes).