Searching files by size range

use like :

find /var/log -type f -size -10M -size +1M -exec ls {} \; > result.txt

It will store files name that have size more than 1Mb and less than 10Mb.

cat result.txt
/var/log/wtmp
/var/log/audit/audit.log.1
/var/log/audit/audit.log
/var/log/anaconda/journal.log
/var/log/mongo/mongod-11.0.0.11.log

If you pass as input parameters then use like:

find /var/log -type f -size -"$1"M -size +"$2"M -exec ls {} \; > result.txt

Below are the available units for size.

  -size n[cwbkMG]
          File uses n units of space, rounding up.  The following
          suffixes can be used:

          `b'    for 512-byte blocks (this is the default if no suffix
                 is used)

          `c'    for bytes

          `w'    for two-byte words

          `k'    for Kibibytes (KiB, units of 1024 bytes)

          `M'    for Mebibytes (MiB, units of 1024 * 1024 = 1048576
                 bytes)

          `G'    for Gibibytes (GiB, units of 1024 * 1024 * 1024 =
                 1073741824 bytes)

The files you find can be sorted numerically (using the size column) like this

find /var/log -ls |sort -nk7

You can store the result in a file if you wish

find /var/log -ls |sort -nk7 > result.txt