Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Desktop
User Name
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.


  Search this Thread
Old 10-31-2006, 08:09 PM   #1
Registered: Jan 2005
Location: Ha Noi, Viet Nam
Distribution: Fedora Core
Posts: 61

Rep: Reputation: 15
where is search tool in Linux ?

I use fedora core and I like to find a tool that allow me to search file that contain a given string. Any help is welcome.

Thank you.
Old 10-31-2006, 08:15 PM   #2
Registered: Apr 2006
Location: Washington
Distribution: Suse, CentOS, Ubuntu
Posts: 124

Rep: Reputation: 15
>locate filename

don't get worried if 'updatedb' takes a while - it creates the database so locate will actually work.
Old 10-31-2006, 09:06 PM   #3
Registered: Mar 2005
Location: Winnipeg, MB
Distribution: Raspbian, Debian, Slackware, OS X
Posts: 443
Blog Entries: 9

Rep: Reputation: 32
find ->

slocate ->
Old 10-31-2006, 09:43 PM   #4
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
If the string is in the file name, use

find /etc -name '*.*' -type f -regex 'string'

where /etc is the directory to search, -name '*.*' is the filename unspecified (wildcards), -type f is regular file (see man find for other file types), and -regex 'string' is the string in the filename.

If you want to find 'string' inside the file, not in the filename, use

find /etc -name '*.*' -type f | xargs grep 'string'

where /etc, -name, and -type are explained above, | is the pipe symbol (pipe the output of find through another command), and the other command is grep to find the 'string' inside the file.

However, it the 'string' is in the filename, a much faster way to find the file is to use the locate command. Locate uses a database of all filenames on the system. The database is built using the updatedb command, which must be run as root.

So, su to root and run updatedb to update the database of filenames, then run locate 'string' (without quotes) to find the filenames with the 'string' in the filename.

Last edited by bigrigdriver; 10-31-2006 at 09:46 PM.
Old 10-31-2006, 10:23 PM   #5
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
If it is the contents of files that you are interested in, consider installing the beagle package. There is a KDE tool called "kerry" that brings up a search dialog. It will search documents and pdf files. I've found it as useful as google at times.
Old 10-31-2006, 11:05 PM   #6
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
There is a new program called searchmonkey. Just made it into Debian Sid, but it's probably generally available. Supposed to replace "grep" and "find"


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
pkg search tool linuxtesting2 Solaris / OpenSolaris 7 03-17-2006 01:43 AM
Linux Search Tool superdude_876 Linux - Software 1 11-30-2005 08:03 PM
fast search tool. bruse Linux - Newbie 4 08-20-2005 10:43 PM
A less discriminatory search tool Goatdemon Linux - Software 4 07-02-2002 11:31 AM
[new tool] Google search bar for Linux vfs Linux - General 8 05-25-2002 06:29 AM > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 05:17 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration