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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-17-2010, 01:25 PM
|
#1
|
|
Member
Registered: Sep 2003
Location: South
Distribution: Ubuntu/CentOS
Posts: 171
Rep:
|
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
|
|
|
|
05-17-2010, 01:30 PM
|
#2
|
|
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,474
|
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
|
|
|
|
05-19-2010, 01:44 PM
|
#3
|
|
Member
Registered: May 2010
Location: Illinois
Distribution: Ubuntu 10.04
Posts: 43
Rep:
|
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-23-2010 at 11:33 PM.
Reason: link spam removed
|
|
|
|
06-01-2010, 08:50 AM
|
#4
|
|
Member
Registered: Sep 2003
Location: South
Distribution: Ubuntu/CentOS
Posts: 171
Original Poster
Rep:
|
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?
|
|
|
|
06-01-2010, 09:05 AM
|
#5
|
|
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,474
|
No, a.pl is just a random file. -o means 'or' so just add more clauses.
|
|
|
|
06-14-2010, 10:01 AM
|
#6
|
|
Member
Registered: Sep 2003
Location: South
Distribution: Ubuntu/CentOS
Posts: 171
Original Poster
Rep:
|
Thanks!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:20 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|