The Empty File Problem
In Ubuntu Linux, system administrators frequently need to isolate files based on their physical footprint. While searching for massive, hard-drive-filling log files is common, the opposite is also true. Malfunctioning scripts or aborted download processes often leave behind thousands of tiny, fragmented files that clutter directories and break backup routines. To clean up a directory, you must instruct the Linux search engine to filter out all normal files and only display items that fall below a specific, ultra-small size threshold.
Using the find Command with -size and Minus (-)
The Linux find command utilizes the -size flag combined with the mathematical minus sign (-) to locate files that are strictly smaller than the specified limit.
- Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
- To scan the
/home/user/downloads/directory and return files that are smaller than 5 Kilobytes, type the following command exactly: find /home/user/downloads/ -type f -size -5k- Press Enter.
The Size Threshold
The minus sign (-) placed immediately before the number is the critical modifier. By typing -5k, you are instructing the search engine to ignore any file that is exactly 5 kilobytes or larger. It will exclusively return files that weigh 4 kilobytes, 1 kilobyte, or 0 bytes (completely empty files), allowing you to surgically isolate and delete tiny fragments left behind by broken software.