Solved

how to search a file

Posted on 2002-06-18
8
271 Views
Last Modified: 2010-04-21
I would like to search a file from home directoty.
How to do it. What is the command for that.
Please help!!!

thanks,

hmk
0
Comment
Question by:hmk
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 7089284
assume that you are in you home dir.
use:

find . -name yourfilename -print

0
 
LVL 20

Expert Comment

by:tfewster
ID: 7089301
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
 
LVL 20

Expert Comment

by:tfewster
ID: 7089321
Ah, yuzh is on the case ; /me goes back to sleep ;-)
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:hmk
ID: 7089643
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
 
LVL 38

Expert Comment

by:yuzh
ID: 7089882
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7089978
find ~ -name yourfile -ls
0
 

Author Comment

by:hmk
ID: 7089984
I got following error when i did this.

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

hmk
0
 
LVL 20

Accepted Solution

by:
tfewster earned 50 total points
ID: 7090001
If using wildcards in the name parameter, they must be enclosed in double quotes
$ find /home/hmk -name "Opt*" -print    
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sort command HPUX 11 76
Java core in Solaris 10 1 283
Bad Block Relocation for Synchronous GLVM AIX 7.1 2 73
UNiX Script filesystem space usage 19 74
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question