Home » Debian, Linux, Quick Tip, Shell

Quick Tip: Using find to search for files in Linux

1 October 2009 One Comment

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 🙂

BlinkList Diigo Digg Facebook Furl Google Mister Wong Newsvine Reddit StumbleUpon Simpy Technorati Yahoo DZone

Hide Bookmarks

One Comment »

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.