@
you're reading...
Linux Tips and Tricks

Find Multiple Files with Different Extensions

Linux “Find” command is one of my tools when administering Linux Servers. I came into situation where I need to find multiple file with different extensions at once. I have tried the regex options but can’t seem to make work. But after googling a bit I have managed to find what I was looking for using the “-o” which means or(somehow equivalent to boolean “or”).

The command below would list all files that are in wav and fbs formats:

find . -name '*.wav' -o -name '*.fbs'

Update:
When I was reviewing, I find it more readable when Find‘s output is piped into grep command. Something like this would still show the same result but the command itself is more cleaner for me.

find . -type f | egrep '\.(wav|fbs)$'

Advertisements

Discussion

No comments yet.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s