Linux 101: Command – Find

I am ashamed to admit it up until recently I very rarely used  find command. Shame really because I really love searching files via Linux terminal. Call me old fashion but typing dos style command is very cool.  Just imagine sitting yourself with cool kids (like this will ever happen) typing gibberish, and everyone is at awe for every stroke of key you press. Well, back reality.

Reason being Ubuntu GUI is pretty good, and you can search file right from the folder. However, there are time you just need to search the file from the command prompt Find is the best way of doing it. Here are the some of the basic syntax of the command I have been using.

If you would like to know which directory & sub-directory it will be searching; just type find Linux  like Unix search case are sensitive. To ignore the case use “iname” this way you don’t need to worry how many letters are capital. iname will  ignore the case when searching for file names. an OR based matching then the find command has the “o” switch.

$ find -name '*.php' -o -name '*.txt'
./test.txt
./.bash
./cool.php

 

Reference:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s