1. Home
  2. Knowledge Base
  3. Unix
  4. How to find files based on size in Unix

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.

Gavin Soorma

Latest posts by Gavin Soorma (see all)

Updated on June 2, 2021

Was this article helpful?

Related Articles

Comments

  1. Hi,
    nice post

    what is the relation between 100 and +200000 ??

    If i have to do for 10mb what is the size number ?

    Thx

  2. 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

Leave a Comment