Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-03-2003, 02:55 PM
|
#1
|
Member
Registered: Dec 2002
Location: St. Louis, MO
Distribution: Slackware 9.1
Posts: 482
Rep:
|
ls entire subdirectory tree
How would I list one file in the entire /usr subdirectory tree named needle from /usr? This file is 3 levels deep, but I don't know it's location. I need to know how to do this from a command line.
I know I'd use ls and a wildcard, but I know there's more I'm missing.
Thanks in advance.
|
|
|
03-03-2003, 02:57 PM
|
#2
|
Moderator
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696
|
'locate filename' ?
|
|
|
03-03-2003, 03:07 PM
|
#3
|
Member
Registered: Dec 2002
Location: St. Louis, MO
Distribution: Slackware 9.1
Posts: 482
Original Poster
Rep:
|
warning: locate: could not open database: /var/lib/slocate/slocate.db: No such file or directory
Hmm, I just installed Slackware too. 
|
|
|
03-03-2003, 03:16 PM
|
#4
|
Member
Registered: Jan 2003
Location: Urbana, IL
Distribution: Slackware, Mandrake
Posts: 62
Rep:
|
Run updatedb as root to create the databse. I would also reccomend to setup a cron job to keep the database up to date.
As far as locating the file, are you looking for its complete path? Or just to verify its existence.
|
|
|
03-03-2003, 03:17 PM
|
#5
|
Moderator
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696
|
'slocate -u' to create the database. Do it. It's useful.
|
|
|
03-03-2003, 06:43 PM
|
#6
|
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
|
locate is better, but for one-time use:
find /usr -name filename
(this is very slow)
|
|
|
07-27-2006, 08:29 PM
|
#7
|
Member
Registered: Jul 2006
Posts: 260
Rep:
|
try to use ls | grep [filename]
or whereis [filename]
|
|
|
All times are GMT -5. The time now is 02:43 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
|
|