how do i search for a file in linux from the command prompt?

bockie

Member
Jan 26, 2001
100
0
76
I use:

find / | grep "filename"

There's probably a more efficient way that I am unaware of.
 

Cyph3r

Senior member
Jan 20, 2000
790
0
0
find / -name 'string' -type f -print

/ - Directory to search. Can be replaced with "." to indicate just the current directory and it's subdirectories.
'string' - Filename containing this string. Wildcards are allowed
f - A type F indicates that you are only looking for files, as opposed to D for directories.
-print - Print result to the string, most versions of find usually default this, so this is MOST probably not required. But it's a habit..:)

Regards
 

Bremen

Senior member
Mar 22, 2001
658
0
0
locate is a faster command, however it requires that you keep an up to date database. Mandrake probably included a cron job to do this, but if you feel like doing it manually the command is slocate. I really suggest reading the related man files.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
If the dir the file is in is in your path the command "which filename" will tell you where it is.