LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 05-17-2010, 02:25 PM   #1
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 232
Blog Entries: 1

Rep: Reputation: 17
Question Using find command to search for all pictures, or all music, etc


Hello all. Trying to find a way to have the find command perform a search using multiple file extensions such as "find all pics" i.e. .jpg, .png, .gif, .raw etc. I would have thought something like the following would have worked, but apparently I'm doing something wrong:

sudo find / -type f -iname "*.jpg" "*.png" "*.gif" -printf

I'm guessing find simply doesn't support more than one "-name/-iname" at a time?

Or perhaps I'm going about this the wrong way? I realize most times there's several different ways to skin a cat when a task is requested in linux/unix.

Thanks for taking the time to help,
Loadedmind
 
Old 05-17-2010, 02:30 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,652

Rep: Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536
You can. From the man page:
Code:
       expr1 -o expr2
              Or; expr2 is not evaluated if expr1 is true.
e.g.:
Code:
~$ find . -name "songs" -o -name "a.pl"
./a.pl
./songs
 
Old 05-19-2010, 02:44 PM   #3
jscherer92
Member
 
Registered: May 2010
Location: Illinois
Distribution: Ubuntu 10.04
Posts: 43

Rep: Reputation: 16
Yeah that looks about right but if I were you I would not use the terminal. I would just go under the file viewer and use that search tool unless you like the terminal better.

Justin

Last edited by Tinkster; 05-24-2010 at 12:33 AM. Reason: link spam removed
 
Old 06-01-2010, 09:50 AM   #4
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 232
Blog Entries: 1

Original Poster
Rep: Reputation: 17
Yeah, the majority of our systems don't even have Gnome/X loaded so File Viewer isn't an option.

AlucardZero, thanks. Am I to understand you correctly that a.pl is a perl script containing all of the file extensions for songs?
 
Old 06-01-2010, 10:05 AM   #5
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,652

Rep: Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536Reputation: 536
No, a.pl is just a random file. -o means 'or' so just add more clauses.
 
Old 06-14-2010, 11:01 AM   #6
loadedmind
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Red Hat/CentOS
Posts: 232
Blog Entries: 1

Original Poster
Rep: Reputation: 17
Thanks!
 
  


Reply

Tags
find


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find command to search wildcard in path? markdjones82 Linux - General 12 12-11-2009 02:02 AM
Issuing find command to search for string keysorsoze Linux - Newbie 4 11-30-2007 01:06 AM
Find command with an IP address as the search aurgment swamprat Linux - Newbie 3 11-02-2007 12:40 PM
Find command using 2 search conditions nifflerX Linux - General 8 07-15-2005 02:37 PM
pattern search through find command. abhi Linux - Newbie 2 04-11-2005 11:31 AM


All times are GMT -5. The time now is 01:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration