• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Techgoeasy

Techgoeasy

Learn Oracle, PHP, HTML,CSS,Perl,UNIX shell scripts

  • Home
  • Oracle
    • Oracle database
    • Oracle Ebusiness Suite
    • Oracle weblogic
    • Oracle Performance Tuning
    • Oracle Hyperion
    • Oracle Cloud Tutorials
  • SQL
  • interview questions
  • Linux
  • PHP and HTML
  • Downloads
  • General
Home » Unix command and scripts » how to find file based on size in linux

how to find file based on size in linux

March 11, 2023 by techgoeasy Leave a Comment

This can be easily done using the find command. The general syntax is

find . -type f -size  +<size> -exec ls -al {} \;

Here are the suffixes available for the size

b – 512-byte blocks (this is the default if no suffix is used)
c – bytes
w – two-byte words
k – Kilobytes
M – Megabytes
G – Gigabytes

If you dont want to list the size, then you can use the below command also

find . -type f -size  +<size> 

Table of Contents

  • How to find files greater than 1 GB
  • How to find files greater than 100 M
  • How to find empty files
  • How to find files smaller than 100M
  • how to find the file in a range of size in Linux

How to find files greater than 1 GB

find . -type f -size +1G -exec ls -al {} \;

This will search in your current directory and subdirectories

If you want to search in /, you can put a command like

find / -type f -size +1G -exec ls -al {} \;

If you want to do it in your home directory, then

find ~/ -type f -size +1G -exec ls -al {} \;

You can provide specific directories also

find /u02 -type f -size +1G -exec ls -al {} \;

How to find files greater than 100 M

find . -type f -size +100M -exec ls -al {} \;

How to find empty files

find / -size 0  -exec ls -al {} \;

How to find files smaller than 100M

find . -type f -size -100M -exec ls -al {} \;

how to find the file in a range of size in Linux

You can find this using the above operator explained above

find . -type f -size +100M -size -200M -exec ls -al {} \;

You can specify whatever size is required

I hope you like this content on how to find file based on size in linux. Please do provide the feedback

Related Articles
find command in Unix with example
Useful Unix/Linux command for Oracle DBA
Grep equivalent in Windows
grep examples

Filed Under: Unix command and scripts

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar



Subscribe to our mailing list

Enter your email address to subscribe to this blog and receive notifications of new posts by email

Recent Posts

  • Oracle tkprof utility
  • What is Skew in Database?
  • how to find file based on size in linux
  • SQL trace, 10046 event in Oracle
  • How to use sed replace string in file

Copyright © 2023 : TechGoEasy

  • Hire me
  • Privacy Policy
  • Contact Us
  • New? Start Here
  • About Us