Searching files for specific text

UNIX/Linux Installation & Configuration

Searching files for specific text

Postby Benji Simms on Mon May 26, 2008 12:01 pm

I can't remember where I put a file. What is the command to search through the files on my computer to find one with the word "Bones" in it?
User avatar
Benji Simms
 
Posts: 5
Joined: Thu May 15, 2008 3:40 pm

Re: Searching files for specific text

Postby Rich Simms on Mon May 26, 2008 12:44 pm

Try:

[code] find / -mount -type f -exec grep -l "Bones" {} \; 2> /dev/null
[/code]

It can take awhile to search through every file. If you see the file you want get listed you can end the search with cntl-c

The find command has a ton of options. Use the man command to read all the documentation on this command:

[code]man find[/code]

- Rich
User avatar
Rich Simms
Site Admin
 
Posts: 640
Joined: Thu May 15, 2008 2:44 pm

Re: Searching files for specific text

Postby Benji Simms on Mon May 26, 2008 12:46 pm

Thanks! I found the file I was looking for.

- Benji
User avatar
Benji Simms
 
Posts: 5
Joined: Thu May 15, 2008 3:40 pm


Return to CIS 191A - Fall 2008

Who is online

Users browsing this forum: No registered users and 0 guests

cron