Linux Tip of the Day – A proper use of find

April 24, 2008 by Adrian  
Filed under Uncategorized

Most often we find a file using the ‘find’ command, but sometimes we know that find does not give results if not used in a proper way.

Here is an example to
demonstrate it.

Assume that /project/src is a symlink then

find /project/src -name …

symlink will not be followed. One alternative way is to use the command

cd /project/src; find . -name …

but /project/src may not exist or could be a dangling symlink! So use the following command to overcome this.

cd /project/src && find . -name …

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!