Find files larger than particular Size in Linux2 min read
We may face disk space issues in our production/development/QA systems were multiple applications will be running. So if we need to search for files greater than the particular size. How would we do that? To check manually each and every file size is particularly difficult. Now we will see how to find files bigger or smaller than X size in Linux systems.
Find Files Bigger Or Smaller Than X size
We can use “find” command to find the files bigger or smaller than the given size.
For now, if we need to find files that are bigger than 2GB in a directory, use the below command.
Here, the dot(.) says the current directory. To search for files in the entire file system we will use the below command.
If we need to search files in the Downloads folder, we will use the below command.
To find the files which are smaller than X size, for example, 2GB, we will use the following commands.
We can use different formats for the size of the file instead of GB, such as
- ‘c’ for bytes
- ‘w’ for two-byte words
- ‘k’ for kilobytes
- ‘M’ for Megabytes
- ‘G’ for Gigabytes
Example of Megabytes ( MB ), to find files greater than 40MB, use the below command,
To find files between a certain size. If we need to find files between 50MB to 80MB we can use the below command.
To find files of the exact size, for example 60MB, use below command.
For more details, you can refer to man pages.