In unix, how do you search by file name in all subdirectories?

wildwildwes

Senior member
Jul 18, 2001
320
0
0
What is the unix command that is equivalent to dir /s in dos? I'm using FreeBSD.

ls -R works to list subdirectories, but when I try to add a file name to search for, it only searches the current directory.

Thanks
 

jhu

Lifer
Oct 10, 1999
11,918
9
81
find / -path '*libc*'

that searches everywhere for any file that has 'libc' in its filename
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
"man find"
"man locate"
"man which"

All three would help quite a bit. I use find daily, locate every couple of days and which I used to use hourly.

EDIT: "find . -name "mystuff*" -print" will find everything starting in the current directory named mystuff*.
 

GreenGhost

Golden Member
Oct 11, 1999
1,272
1
81
You can also use ls -R and then pipe ( | ) the results into grep to search for the file name. There are always a zillion ways of doing things. (I never liked the 'find' command, for some odd reason)
 

miguel

Senior member
Nov 2, 2001
621
0
0


<< You can also use ls -R and then pipe ( | ) the results into grep to search for the file name. There are always a zillion ways of doing things. (I never liked the 'find' command, for some odd reason) >>



Yeah, but you won't know which directory it's in.