Linux ‘find’ to list files less than or greater than a certain size

number of files, linux, ubuntu, red hat

This article will go through some basic examples on how to list files above or below a certain size in Linux using the find command. There are many use cases for running queries like this, for instance finding small files on your hard drive or finding very large files. So, lets get started with some examples.

Using find to show files below a certain size (1000 bytes = 1K)

find . -type f -size -1000 -ls

Using find to show files above a certain size (1,000,000 bytes = 1M)

find . -type f -size +1000000 -ls

In the above commands, the -ls command will display the file size, date, and other attributes regarding the file. If you would like just the path and filename, then omit the -ls.

See also  Linux - How to Find the Number of Files in a Directory

2 thoughts on “Linux ‘find’ to list files less than or greater than a certain size”

  1. Thanks for the tip.

    for the record, on ubuntu 12.04, I had to use this:

    find . -type f -size -1000c -ls

    the small ‘c’ is required to work with bytes, otherwise it uses 512-byte blocks (e.g. option ‘b’ instead of ‘c’). Counter-intuitive, I know …

Leave a Comment