Filter ls output based on file size

You can do that using find:

find . -type f -size +100k | grep '.png\|.jpg'

Where +100k specifies the size in KB, meaning that only files larger than this should be output. find also has some other nice options, for example to only list files that were created a certain amount of time ago. See man find for more details.

The above could also be rewritten as

find . -type f -size +100k -name "*.png" -o -name "*.jpg"

As others have suggested, find will allow you to find files in specified size ranges. Find outputs just the path to each file, though. Also, without further qualification, find will find all the files in the current directory and in every directory below the current directory. The following searches only the current directory and uses ls to dispaly the results.

find . -maxdepth 1 -size +200 \( -name \*.png -o -name \*.jpg \) -print | xargs ls -ldh

Note that the size is in blocks, where a block is often if not always 512 bytes.


Use find instead of ls:

find . -type f -size +100k \( -name \*.png -or -name \*.jpg \)