LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-13-2006, 10:20 AM   #1
basak
Member
 
Registered: Jul 2006
Posts: 41

Rep: Reputation: 15
recursively search


Hi!Is there a bash shell command which recursively searches the subdirectories of a given directory to find the path of a given file?Thanks a lot)
 
Old 08-13-2006, 10:25 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668Reputation: 1668
You can do:

cd <directory>
find . -name <filename>

This will recursively look through the directory for the file you want. You don't really even have to cd there first. The dot (.) says "this directory". You could instead just type:

find <directory> -name <filename>

That would tell it to search recursively through the specified directory (e.g. find /var -name mqueue would find mqueue in /var/spool for you.)

find has many other options (-xdev to restrict to current filesystem is good when you want to search / but not filesystems mounted on it like /opt or /home). Type "man find" for more details.
 
  


Reply


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
stripping ^m recursively. SaxiDawg Linux - General 1 06-07-2006 04:27 AM
To recursively search with grep grautu Slackware 5 11-21-2005 02:53 AM
RemovePkg Recursively? Kenji Miyamoto Slackware 3 05-23-2005 08:33 AM
search default: search post title only slackie1000 LQ Suggestions & Feedback 4 03-10-2005 07:50 AM
Quick VIM question (unhighlighting search terms after search) lrt2003 Linux - Newbie 5 05-08-2004 05:21 PM

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

All times are GMT -5. The time now is 12:32 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
Open Source Consulting | Domain Registration