Search file in a unix

Hi All,

There is one file in one of the directory in my Unix. I don't remember the file name and location exactly, But i have some what idea about the file name.

Is it possible that the Unix can search that file in all directories and if any of the file name resemble that name i have given should display it

Yes, You can use find in unix.

find . -name "PartOfFileName"

For More Information, just do the below in your unix terminal.

man find 

Cheers,
Ranga:)

Hi,

You can use find command ,

find `pwd` -name "partoffilename"

if you need to get the full path means you can use this

cheers,
shanmu

For the above commands you need to change "partoffilename" to "*partoffilename*"

Hi.

For files that have been around for some time, I usually try locate first:

#!/usr/bin/env bash

# @(#) s1	Demonstrate finding files via "locate", "updatedb".

pe() { for _i;do printf "%s" "$_i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }
db() { ( printf " db, ";for _i;do printf "%s" "$_i";done;printf "\n" ) >&2 ; }
db() { : ; }
C=$HOME/bin/context && [ -f $C ] && $C locate 

pe
locate 968.tar

exit 0

producing:

% ./s1

Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: FreeBSD, 8.0-RELEASE, i386
bash GNU bash 4.0.33
locate - ( /usr/bin/locate, Nov 21 08:56:25 2009 )

/usr/home/drl/968.tar

Noting, however:

     The locate program may fail to list some files that are present, or may
     list files that have been removed from the system.  This is because
     locate only reports files that are present in the database, which is typ-
     ically only regenerated once a week by the
     /etc/periodic/weekly/310.locate script.  Use find(1) to locate files that
     are of a more transitory nature.

-- excerpt from man locate, q.v.

On GNU/Linux, the command updatedb can be used by root to refresh the database.

Best wishes ... cheers, drl