Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a Linux server, I need to find all files with a certain file extension in the current directory and all sub-directories.

Previously, I have always using the following command:

find . -type f | grep -i *.php

However, it doesn't find hidden files, for example .myhiddenphpfile.php. The following finds the hidden php files, but not the non-hidden ones:

find . -type f | grep -i \.*.php

How can I find both the hidden and non-hidden php files in the same command?

share|improve this question
    
You know that the "re" in "grep" stands for "regular expression", right? I have no clue how either of those command lines are supposed to work... – Ignacio Vazquez-Abrams May 6 '10 at 7:56
up vote 14 down vote accepted

...

find . -type f -name '*.php'
share|improve this answer
    
Thanks - and sorry for my stupidity ;-) – Tom May 6 '10 at 8:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.