Linux Tips: find all files of a particular size

The Unix find command is a very powerful tool, and this short post is intended to show how easy you can achieve something that might look complicate: to find all the files of a particular size. Let’s assume you are searching for all the files of exactly 6579 bytes size inside the home directory. You will just have to run something like:

find /home/ -type f -size 6579c -exec ls {} \;

As units you can use:

You can search for exact file size, or just for bigger (+) or smaller (-) files. For example all bigger than 512k files would be found with something like:
find /home/ -type f -size +512k -exec ls -lh {} \;

I have added here -lh to the ls output so it will actually show the files with their sizes in a nice human readable format. Similar for smaller files you would use -size -512k.

Tags:

Share This

Related Posts:

5 Responses to “Linux Tips: find all files of a particular size

Leave a Reply

Recommended Sites