# finding php, html, htm files

**URL:** <https://community.unix.com/t/finding-php-html-htm-files/292815>\
**Category:** Shell Programming and Scripting\
**Created:** [August 3, 2011, 3:17pm UTC](https://community.unix.com/t/finding-php-html-htm-files/292815 "2011-08-03T15:17:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vanessafan99](https://community.unix.com/letter_avatar/vanessafan99/32/6_449c533f586939b6e5f246632a46421f.png) [@vanessafan99](https://community.unix.com/u/vanessafan99)\
**Post date:** [August 3, 2011, 3:17pm UTC](https://community.unix.com/t/finding-php-html-htm-files/292815/1 "2011-08-03T15:17:17Z")

</div>

how can i limit the output to only php, html, htm files?

i found this as one way

```nohighlight
find . -regex ".*\(php\|html\|htm\)$" -type f -print0 | xargs -0 grep 'keyword'

```

and it works but is a bit slow  
is there any faster way?

i tried something like this but it doesnt work:

```nohighlight
find ./ -iname "*.php" -or -iname "*.html"

```

how can i do an "or" for -name \*.php  
or -name \*.htm  
or -name \*.html?

---

<div class="post-metadata">

**Author:** ![Yeaboem](https://community.unix.com/letter_avatar/yeaboem/32/6_449c533f586939b6e5f246632a46421f.png) [@Yeaboem](https://community.unix.com/u/Yeaboem)\
**Post date:** [August 3, 2011, 4:39pm UTC](https://community.unix.com/t/finding-php-html-htm-files/292815/2 "2011-08-03T16:39:49Z")

</div>

crude attempt.. patterns not bounded by end of line.. but may work for you.

```nohighlight
find /some/path \( -name "*.php" -o -name "*.html" -o -name "*.htm" \)

```

---

<div class="post-metadata">

**Author:** ![methyl](https://community.unix.com/letter_avatar/methyl/32/6_449c533f586939b6e5f246632a46421f.png) [@methyl](https://community.unix.com/u/methyl)\
**Post date:** [August 3, 2011, 4:56pm UTC](https://community.unix.com/t/finding-php-html-htm-files/292815/3 "2011-08-03T16:56:15Z")

</div>

Yeaboem's solution is correct and efficient. I might add "-type f" if you are not interested in directory names.

```nohighlight
find /some/path -type f \( -name "*.php" -o -name "*.html" -o -name "*.htm" \) 

```
