LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 02-13-2006, 08:00 AM   #1
ckoniecny
Member
 
Registered: Oct 2005
Posts: 162

Rep: Reputation: 30
Best Find Command


I have a couple ways of searching the entire filesystem for a file, but I'm not sure if its the best way. I usually use:

Code:
find / -name filename -print
or

Code:
locate filename
What are some other useful ways you can search the filesystem?

Thanks.
 
Old 02-13-2006, 08:07 AM   #2
satinet
Senior Member
 
Registered: Feb 2004
Location: England
Distribution: Slackware 14.2
Posts: 1,491

Rep: Reputation: 50
there is beagle on gnome that acts like the google desktop search.

find is a bit different to slocate. finding file names is only a small part of what find is actually for - read the man page. you can search for files over a certain age etc.

wherease slocate is a quick file searching utility and they are quite different in that regard. slocate often neeed to be piped (|) into other commands to filter the output.

i think you've already struck on the best two choices.
 
Old 02-13-2006, 08:55 AM   #3
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
For KDE users there is kat. It's search not only for filenames but it can search for a string inside documents, e-mails, etc..
 
Old 02-13-2006, 10:27 AM   #4
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
i use slocate from the terminal, never had any problems (except having to run updatedb if i'm searching for something relatively new on the system)
 
Old 02-13-2006, 10:44 AM   #5
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
For generic global searches, I use locate. But for something which is specific or weird, I use find. I've never tried kat or beagle... but I'm usually at the command line anyway when I am looking for something.
 
Old 02-13-2006, 04:42 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Is there a difference between locate and slocate?
 
Old 02-13-2006, 05:08 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by ntubski
Is there a difference between locate and slocate?
You mean other than the name? ;)

Yeah, slocate will only show files you actually have
access to (it's secure locate, that's where the s came
from [in case you wondered]).


Cheers,
Tink
 
Old 02-13-2006, 06:14 PM   #8
jerril
Member
 
Registered: Nov 2005
Location: Ontario, Canada
Distribution: Linux Mint
Posts: 116

Rep: Reputation: 16
Thumbs up Beagle is great!

Quote:
Originally Posted by satinet
there is beagle on gnome that acts like the google desktop search.
Awesome suggestion, I just installed it, and it seems to work very well.

It doesn't choke on odd suffixes in file names like google desktop search does. I use a an oddball suffix for journals and other files with a custom markup; they're still plain old text.

Thanks
jer
 
Old 02-13-2006, 07:08 PM   #9
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
Quote:
slocate will only show files you actually have access to
I didn't know about slocate, and it's sometimes mildly irritating to have to switch over to root when I've simply forgotten where I put something.

so I tried to run slocate as a non-privledged user. Didn't exist. Checked my repo, sure enough, it said I didn't have it installed. I installed it. Didn't do what I expected.

As near as I can tell, I can now run either 'locate' or 'slocate' as a non-privledged user, and it returns all the same files as root. This is not really a problem for me on my own personal PC, but I'd be cautious if I didn't want regular users to see files thay can't write or execute.

Maybe this is just a bug in Debian Etch.
 
Old 02-13-2006, 07:35 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Did you run updatedb -c after the update?


Cheers,
Tink
 
Old 02-14-2006, 11:47 AM   #11
satinet
Senior Member
 
Registered: Feb 2004
Location: England
Distribution: Slackware 14.2
Posts: 1,491

Rep: Reputation: 50
Hi jerril,

yeah i installed Foresight linux because it has beagle installed as default (along with some other cool stuff). but i haven't had time to get it going. well, and the fact that there is very little info on how to use foresight (even on their own website!).
 
Old 02-14-2006, 12:36 PM   #12
jerril
Member
 
Registered: Nov 2005
Location: Ontario, Canada
Distribution: Linux Mint
Posts: 116

Rep: Reputation: 16
It was a little odd.

Hey satinet

When it opened; I entered a search for a string in a file that I knew would be in my directory tree.

It delivers a message after I enter a search term:
Quote:
The query for gimli failed.
The likely cause is that the beagle daemon isn't running.
and below it:
Quote:
Click to start the Beagle daemon...
I clicked and that started the daemon; but there is a delay as it builds the index. Eventually it began to return results. There was little feedback, the gnome waiting cursor was intermittent as it went on. If you have a large directory tree, it might be time for tea.

I'm looking at the man pages to see what there is, so far I've found:

Code:
$ apropos beagle
beagle-build-index (8) - (unknown subject)
beagle-config (1)    - command-line interface to the Beagle configuration file
beagle-manage-index (8) - (unknown subject)
beagle-query (1)     - search your personal information space
beagle-shutdown (1)  - cleanly shutdown the Beagle daemon
beagle-status (1)    - repeatedly display Beagle status
beagled (1)          - the Beagle daemon
I'll be reading up over the next... uh dunno.

later
jer

Last edited by jerril; 02-14-2006 at 12:45 PM.
 
Old 02-14-2006, 03:14 PM   #13
satinet
Senior Member
 
Registered: Feb 2004
Location: England
Distribution: Slackware 14.2
Posts: 1,491

Rep: Reputation: 50
jerril,

i dont have an ubuntu install at the moment, i guess you installed the normal way. sounds like your 'beagle' daemon is not starting at boot time. check with 'sudo ps -ef|grep -i beagle'.

i would have thought it would have installed the relevant rc script. depends how you installed it. i've never even used it yet!
 
Old 02-15-2006, 01:46 AM   #14
jerril
Member
 
Registered: Nov 2005
Location: Ontario, Canada
Distribution: Linux Mint
Posts: 116

Rep: Reputation: 16
satinet

No big problem, I don't know if I will need beagle very often. I know where most of my stuff is, and I have better ways of dealing with it on my own.

I'll play around with Beagle, it will be available for me when I need it. I like the command line counterpart, nice touch. As I poke around, I see more I like.

It keeps Tomboy indexes too (another cool program my own way of work using vi and bash does better, I'ts nice to have some decent gui tools though).

Happy Computing

jer
 
Old 02-15-2006, 10:09 AM   #15
rickh
Senior Member
 
Registered: May 2004
Location: Albuquerque, NM USA
Distribution: Debian-Lenny/Sid 32/64 Desktop: Generic AMD64-EVGA 680i Laptop: Generic Intel SIS-AC97
Posts: 4,250

Rep: Reputation: 62
Quote:
Did you run updatedb -c after the update? -- Tinkster
That command returned 'updatedb: option requires an argument -- c'

Checked man updatedb ... Doesn't include a -c option.

When I installed slocate, there was an instruction on the screen to run updatedb with some options which I can't remember anymore. I did that.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 05:30 PM
`find' command cdnsupra Linux - Newbie 4 12-18-2005 11:13 AM
find command jch02140 Linux - Newbie 2 07-19-2005 12:21 AM
not find mt command imsajjadali Red Hat 2 02-07-2004 06:27 AM
Find command?? mylo2003 Linux - Newbie 3 08-07-2003 02:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:31 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