Quick Tip: Using find to search for files in Linux
In 99% of my searches I’m using Midnight Commander search function, but sometimes I had servers where I didn’t had mc , so I was forced to search for a file with find. Anyway find is a very powerfull tool and combined with other linux tools like awk, sed, etc can do a lot of things in a very short time.
For example I will try to find my mp3 files from my home folder:
$ find /home/sacx -name '*.mp3'
It will return a list with my mp3 files, but if we want to search for mp3 files with the size bigger than 1MB we will use
$ find /home/sacx -name '*.mp3' -size +100k
$ find /home/sacx -name '*.mp3' -size -1000k
if you want to find a file smaller then 10MB.
If you want to search all the files excluding file what start with “Britney” and bigger than 5MB than you should use:
$ find /home/sacx ! -name 'Britney*.mp3' -size +500k
find have a lot of options, but I will let you to find them 🙂