How to find files based on size in Unix For example – to find all files > 100 MB in size find . -size +200000 -exec ls -l {} \; The following two tabs change content below.BioLatest Posts Gavin Soorma Latest posts by Gavin Soorma (see all) Updated on June 2, 2021 Was this article helpful? Yes No About The Author Gavin Soorma Gavin Soorma has not written a bio yet38 Related Articles Unix – tar and gzip commands Unix for the Oracle DBA – Part 1 Performance Tuning Tips and Techniques Data Guard Log Shipping Report Add color to the Unix PS1 prompt Customizing the Unix prompt (PS1)
vinay 14 years ago Hi, nice post what is the relation between 100 and +200000 ?? If i have to do for 10mb what is the size number ? Thx
Gavin Soorma 14 years ago Hi Vinay – it is based on the Unix block size – in this AIX machine (as in most other cases as well) it is 512 bytes so the command below will list all files > 10 KB using the +20 flag in the ‘size’ command testdb:/u01/oracle/scripts> find . -size +20 -exec ls -l {} \; -rw-r—– 1 oracle dba 57344 Sep 9 2004 ./20040910/exp_prospector_schema_gnu1a.exp -rw-r—– 1 oracle dba 10713771 Sep 10 2004 ./20040910/exp_prospector_schema_gnu1a_rowsY.exp.Z -rw-r—– 1 oracle dba 16826 Sep 20 2004 ./20040920/edify_userprofile_20040920.dmp.Z -rw-r—– 1 oracle dba 102400 Sep 24 2004 ./20040924/test.imp -rw-r—– 1 oracle dba 106496 Feb 2 2006 ./cr19625_20060202/edify_userprofile.dmp -rw-r—– 1 oracle dba 71016 Jul 8 2008 ./p5632264_10203_AIX64-5L.zip -rw-r–r– 1 oracle dba 283359 Aug 18 2008 ./tutorial.sql testdb:/u01/oracle/scripts> This command will list files > 10 MB testdb:/u01/oracle/scripts> find . -size +2000 -exec ls -l {} \; -rw-r—– 1 oracle dba 10713771 Sep 10 2004 ./20040910/exp_prospector_schema_gnu1a_rowsY.exp.Z
Hi,
nice post
what is the relation between 100 and +200000 ??
If i have to do for 10mb what is the size number ?
Thx
Hi Vinay – it is based on the Unix block size – in this AIX machine (as in most other cases as well) it is 512 bytes
so the command below will list all files > 10 KB using the +20 flag in the ‘size’ command
testdb:/u01/oracle/scripts> find . -size +20 -exec ls -l {} \;
-rw-r—– 1 oracle dba 57344 Sep 9 2004 ./20040910/exp_prospector_schema_gnu1a.exp
-rw-r—– 1 oracle dba 10713771 Sep 10 2004 ./20040910/exp_prospector_schema_gnu1a_rowsY.exp.Z
-rw-r—– 1 oracle dba 16826 Sep 20 2004 ./20040920/edify_userprofile_20040920.dmp.Z
-rw-r—– 1 oracle dba 102400 Sep 24 2004 ./20040924/test.imp
-rw-r—– 1 oracle dba 106496 Feb 2 2006 ./cr19625_20060202/edify_userprofile.dmp
-rw-r—– 1 oracle dba 71016 Jul 8 2008 ./p5632264_10203_AIX64-5L.zip
-rw-r–r– 1 oracle dba 283359 Aug 18 2008 ./tutorial.sql
testdb:/u01/oracle/scripts>
This command will list files > 10 MB
testdb:/u01/oracle/scripts> find . -size +2000 -exec ls -l {} \;
-rw-r—– 1 oracle dba 10713771 Sep 10 2004 ./20040910/exp_prospector_schema_gnu1a_rowsY.exp.Z