Home ยป How To ยป How to Find Files Larger than a Given Size in Linux

How to Find Files Larger than a Given Size in Linux

Generally, the development and staging environments have disk issues where multiple applications are running. Sometimes we also face low disk space on production systems.

There are many cases where the production application goes down due to disk full on the server. Few applications may generate log files in large size, which causes disk full. So just to deal with this situation we can find out files of defined size and see if they are not important and then purge them.

Find Large Files in Linux

You can define size in KB, MB, and GB formats. For example, you can define size 100K, 100M, 1G or 10G formats. Use the below examples, which will help you to find files by their size and extension.

  • Find all files larger than or equal to 100 MB under the entire file system.
    find / -type f -size +100M 
  • Find all files greater than 1 GB size in the root file system.
    find / -type f -size +1G 

Similarly, you can give any size as per your requirement to get the desired result.

Related:  How to Use 7-Zip in Linux

Find Files by Size and Extension

Instead of searching all files, you can also search files of specific extensions greater than 1G B size. For example search, all files with extension โ€œ.logโ€ and size are 1 GB or more.

find / -type f -name "*.log" -size +1G 

That’s it, feel free to use the comment section in case of any query ๐Ÿ˜Ž

Leave a Comment