find a file
Nils Kassube
kassube at gmx.net
Mon Aug 6 12:44:52 UTC 2007
John Dangler wrote:
> find -name "searchterm" /
> Will search the entire drive for files...
Make that
find / -name "searchterm"
because the path needs to precede other options.
> As to the secondary question regarding grep, to find a specific word in
> a file (or files) in a directory, I usually do this little shell
> script, typed at the commandline- for word in `ls`
> do
> cat $word | grep "searchword"
> done
>
> That will search each file in a directory and tell you which files have
> the word you want (if any)
You can use grep alone:
grep -re "searchword" *
or if you only want to list the filenames:
grep -lre "searchword" *
Nils
More information about the ubuntu-users
mailing list