how to search a file

I would like to search a file from home directoty.
How to do it. What is the command for that.
Please help!!!

thanks,

hmk
hmkAsked:
Who is Participating?
 
tfewsterConnect With a Mentor Commented:
If using wildcards in the name parameter, they must be enclosed in double quotes
$ find /home/hmk -name "Opt*" -print    
0
 
yuzhCommented:
assume that you are in you home dir.
use:

find . -name yourfilename -print

0
 
tfewsterCommented:
To locate a file in your home directory:
find ~ -name "*partialfilename*" -print

To find a string within a file somewhere in your home directory tree is more awkward, but:
find ~ -type f -print -exec grep searchstring {} \;
should get you started.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
tfewsterCommented:
Ah, yuzh is on the case ; /me goes back to sleep ;-)
0
 
hmkAuthor Commented:
Is it possible to find out the file without knowing where it is ? And also i want path of the file too.
Please help

hmk
0
 
yuzhCommented:
ok you want the full path to the file, lets assume your home dir is: /home/hmk (some sys adm, use /export/home/hmk,
cd ~, and type in: pwd, to find out)
use:

find /home/hmk -name yourfilename -print

0
 
ahoffmannCommented:
find ~ -name yourfile -ls
0
 
hmkAuthor Commented:
I got following error when i did this.

$ find /home/hmk -name Opt* -print    
find: missing conjunction

hmk
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.