Possibly the best Linux find command examples

If you have been looking for a file on Mac OS X or Linux or Unix, you want to use the “find” command. The problem with the find command is that the usage information at the command line is just terrible. The solution is to bookmark this awesome website:
http://www.thegeekstuff.com/2009/03/15-practical-linux-find-command-examples/

Here are some of my favorites:

Find a file by name in any directory starting with the root path

find / -name passwd

Find a file by name (case-insensitive) starting at the current directory and then run the command md5sum on each file that matches.

find -iname "MyCProgram.c" -exec md5sum {} \;

Find files starting in your home directory that are larger than 100 megatbytes.

find ~ -size +100M

And last, but not least, create an alias for a find command that will remove all files named “a.out” starting from the current directory

alias rmao="find . -iname a.out -exec rm {} \;"
rmao

Happy Hunting!

Author: sirspot

I write software, love my wife and kids, do various house projects, play video games when I have time, and could use a little more sleep