LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-26-2005, 10:00 AM   #1
dr_zayus69
Member
 
Registered: Sep 2004
Location: western massachusetts
Distribution: fedora core 3, Suse 10
Posts: 877

Rep: Reputation: 35
having trouble with ls and find finding files.


I have tried doing searches with ls and find to find files and i get no output. I know this is possible but the thing is i know i have at least of that file and it isn't find it. I tried doing ls | grep *.jpg to find all my pics in my home directory to start sorting thru them and nothing came up when i know i have pics in there. Does anyone know why this might possibly be occuring? Any replies would be appreciated. Thanks in advanced.
 
Old 05-26-2005, 10:06 AM   #2
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
grep uses regular expressions for its "grammar". so you can either use shell wildcards like this:
Code:
ls *.jpg
or regular expressions like this:
Code:
ls | grep ".*\.jpg"
 
Old 05-26-2005, 10:11 AM   #3
afaiq
Member
 
Registered: Jul 2003
Location: Bay Area, CA
Distribution: SuSE 10.2
Posts: 33

Rep: Reputation: 15
find . -name "*.jpg" -print

will find files in the current directory and all its subdirectories and print to the console
 
Old 05-26-2005, 10:20 AM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Quote:
Originally posted by afaiq
find . -name "*.jpg" -print

will find files in the current directory and all its subdirectories and print to the console
On most Linux/Unix systems you probbly won't need to include "-print" when using find.
 
Old 05-26-2005, 10:36 AM   #5
dr_zayus69
Member
 
Registered: Sep 2004
Location: western massachusetts
Distribution: fedora core 3, Suse 10
Posts: 877

Original Poster
Rep: Reputation: 35
ok i see. so i was using a special character special to grep and find that i needed to escape. thanks for the quick replies.
 
  


Reply



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
trouble finding getopt.h (c++) Feminista Programming 2 09-19-2004 09:39 PM
trouble finding libgd trross33 Linux - Software 1 05-21-2004 08:32 AM
trouble finding cdrom techrolla Linux - Newbie 2 05-03-2004 11:33 PM
Having trouble finding the right driver... balance Slackware 3 02-28-2004 01:56 AM
Trouble finding the groups Daredevil Linux - Newbie 1 02-27-2004 11:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:05 AM.

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
Open Source Consulting | Domain Registration