How to Find Multiple Files(Extensions) using “find” command?

Linux allows user to manage maximum number of files and directories from Command Line Interface. With the Linux command user can create, delete and manage several other task related to files and directories. Even Linux allows user to find one or more files from thousand with the find command.

Today, in this tutorial we are going to discuss more about “find” command to find multiple files(extensions) at one time.

“find” command”

With find command we can,

  1. Find all files ending with extension “.php” and “.html
  2. Find all files ending with extension “.php“, “.tar.gz” and “.jpg
  3. Find all files ending with extension “.php“, “.html“, “.jpg” and “.png

#1. Find all files ending with extension “.php” and “.html”

The syntax to find files in a current directory with two different extensions “.php” and “.html” is as given.

 find . -type f \( -name "*.php" -o -name "*.html" \)

#2. Find all files ending with extension “.php”, “.tar.gz” and “.jpg”

The syntax to find files in a current directory with three different extensions “.php”, “.tar.gz” and “.jpg” is as given.

 find . -type f \( -name "*.php" -o -name "*.tar.gz" -o -name "*.jpg" \)

#3. Find all files ending with extension “.php”, “.html”, “.jpg” and “.png”

The syntax to find files in a current directory with four different extensions “.php”, “.html”, “.jpg” and “.png” is as given.

find /path/of/dir -type f \( -name "*.php" -o -name "*.html" -o -name "*.jpg" -o -name "*.png" \)

Thus, the above explained commands will help you to find multiple files(extensions) using “find” command. Do share it with your colleagues if you find it working. Connect with us on social media pages.

Facebook Page: https://facebook.com/redserverhost                                                                                       Twitter Page: https://twitter.com/redserverhost.com

Scroll to Top