Solved

Using Find

Posted on 1998-10-02
6
156 Views
Last Modified: 2013-12-06
I have tried using find to search for a file, but am probably using the wrong commands. How do I find a file, for which I  have a partial name and I do not know its location (using HP-UX)?
0
Comment
Question by:jsembhi
6 Comments
 

Author Comment

by:jsembhi
ID: 2007170
Edited text of question
0
 
LVL 10

Accepted Solution

by:
rbr earned 10 total points
ID: 2007171
use find . -name "*partialname*" -print
0
 
LVL 10

Expert Comment

by:rbr
ID: 2007172
You must be in the root path if you want to search all your HD.
cd /

0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
LVL 5

Expert Comment

by:ecw
ID: 2007173
HP-UX is posixified, so you don't need -print, so this'll work too:
  find / -name '*partialname*'
0
 
LVL 1

Expert Comment

by:plebras
ID: 2007174
The exact command is  (to avoid pipe files which block the search)
cd /
find . -type f -name 'thenameof file" -print
0
 

Expert Comment

by:nfrances
ID: 2007175
the second parameter is where to start searching (hence they say to go to the root directory and use a "." as the second parm)...  you could just as easily specify the directory path in this parm.

The more important point is how to get rid of the flurry of error messages that you will get from "find: cannot open ..."   To move them safely away from your terminal, use:

find . -name '*name*' -print 2>/dev/null

which redirects standard error to /dev/null (blackhole).
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unix, date minus 1, 2 or 3 days (last working day) 11 67
Shell script errors 10 141
Unix Command -- Challenging  question 7 95
How to Insert a File Using Text Editor 9 92
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…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
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.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

840 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