The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 10-25-2008 09:37 AM
Find Oldest file in a directory tree rahulrathod Shell Programming and Scripting 24 06-05-2008 03:01 PM
find the length of file names in a directory? koti_rama Shell Programming and Scripting 5 06-04-2008 07:19 AM
find full directory and delete old dated file? xramm Shell Programming and Scripting 2 07-07-2007 06:56 AM
how to find a corrupted file in a directory skarthik_d UNIX for Dummies Questions & Answers 1 07-04-2006 07:45 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-21-2002
milhan's Avatar
Registered User
 

Join Date: Oct 2002
Location: /home
Posts: 121
Smile find a file or directory under public_html

Hi there,

I have a quick question about the UNIX command find, if you can help me I will appreciate it...

I am trying tho find a file which is under my 'public_html' directory.
As I know, I am making the command > find ~ -name filename(or directory name) to find the file or directory under my root directory(UNIX account). However, this command does not work for the files&directories which exist under my public_html directory. Then, I found a new command such as: > find /var/www/myloginname -name filename -- this commands works, and it finds the file or directory under my public_html directory. On the other hand, what if I don't know where the file or directory is, that is, whether it is under pubic_html or not.... Is there not a command which when applied under root directory it finds all files, also the ones which are under my public_html directory ???

Any sugestions???
Forum Sponsor
  #2  
Old 10-21-2002
Registered User
 

Join Date: Aug 2002
Location: Marlboro, MA
Posts: 114
find / -name <filename>

will make a search for the file in the whole of root dir... if you don't have read permissions to most of the sub-dirs which is mostly the case, you will have to see lot of "permission denied"

the ~ stands for the users directory like /home/user/ , so that ~buddy becomes /home/user/buddy
  #3  
Old 10-21-2002
Registered User
 

Join Date: Aug 2002
Location: Marlboro, MA
Posts: 114
~ stands for your home directory effectively saying

cd and cd ~ and cd $HOME are all same...
  #4  
Old 10-21-2002
milhan's Avatar
Registered User
 

Join Date: Oct 2002
Location: /home
Posts: 121
yeah, I know this command already, however it searches the whole system, this is not what I want. I want to make the search under my home directory...
EX: Think that I have a file named Commands under --> /user/s2/milhan/SQL directory (/milhan is my home directory). then when I make > find ~ -name Commands it finds and gives me the path: /user/s2/milhan/SQL/Commands. That's what I am trying to do for the files under my public_html directory, /user/s2/milhan/public_html (/milhan is my home directory). Say, I have a directory called hw1 under /user/s2/milhan/public_html/15a directory, and I don't know where it is... How can I find this directory?




Quote:
Originally posted by Vishnu
find / -name <filename>

will make a search for the file in the whole of root dir... if you don't have read permissions to most of the sub-dirs which is mostly the case, you will have to see lot of "permission denied"

the ~ stands for the users directory like /home/user/ , so that ~buddy becomes /home/user/buddy
  #5  
Old 10-23-2002
Registered User
 

Join Date: Oct 2002
Location: United Kingdom
Posts: 9
You can try

(find / -name filename > /dev/tty) >& /dev/null

This will avoid error messages to be printed on screen.
__________________
Thanks
Vikas Srivastava
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:28 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0