Click to See Complete Forum and Search --> : file search


bigSteve
06-07-2003, 12:57 PM
Hi All,

In windows you acn search for a file quite easily using the file/folder search that comes with all windows installs.

Q. How do you do this in Linux ? How would I for example find the occurences of the file 'fred.txt' in my entire file system ?

THanx,

bigSteve

jscott
06-07-2003, 05:21 PM
find / -name 'file.txt' 2>/dev/null

the arguments are broken down as follows:

/ -- The path to start search from, can be anythin
-name 'file.txt' -- the file's name you're seeking
2>/dev/null -- redirects those pesky "Permission denied" errors to the bit bucket.

man find for a *ton* of more options

EscapeCharacter
06-07-2003, 06:45 PM
you could use locate which is much faster. you would have to setup a cron job that updates it every couple hours or whatever

JohnT
06-07-2003, 07:20 PM
You could run the command "updatedb" which will update you current data. Once that runs you can use the command/s "slocate file.txt" or just "locate file.txt" or any string that you want to search for, besides file.txt, using either of the two commands. Run the command "updatedb" whenever there are any changes to the database, such as adding or deleting software or moving files to another directory to keep it current.