Visit Our UNIX and Linux User Community


find a file or directory under public_html


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users find a file or directory under public_html
# 1  
Old 10-21-2002
Bug 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??? Smilie
# 2  
Old 10-21-2002
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
~ stands for your home directory effectively saying

cd and cd ~ and cd $HOME are all same...
# 4  
Old 10-21-2002
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
You can try

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

This will avoid error messages to be printed on screen.

Previous Thread | Next Thread
Test Your Knowledge in Computers #360
Difficulty: Medium
The find command first appeared in Version 4 AT&T UNIX.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to find and get a file in an entire directory with an excluded directory specified?

How to get a file 'zlib.h' in an entire directory with an excluded directory specified lives under that starting directory by using find command, as it failed on: $ find . -name 'zlib.h' -a -ipath 'CHROME.TMP' -prune -o -print it'll just list entirely up (2 Replies)
Discussion started by: abdulbadii
2 Replies

2. Shell Programming and Scripting

how to find a pattern from an external file in a directory containing multiple file recursively

Hi, Need your help in this. I have an input file that has multiple enrollment_number, somewhat like 1234567 8901234 9856321 6732187 7623465 Now i have to search and delete these enrollment_number recursively from all the files that are within multiple sub-directories of a... (10 Replies)
Discussion started by: mukulverma2408
10 Replies

3. UNIX for Dummies Questions & Answers

cannot find file directory

hi, i use command at below to copy the file and put it in the new file (if no such file, it will create right ) cat id_rsa.pub >>~/.ssh/authorized_keys it give me error bash: /home/pc2/.ssh/authorized_keys : No such file or directory can anyone tell me why this happened ? thanks in... (1 Reply)
Discussion started by: Ericyue
1 Replies

4. Shell Programming and Scripting

Find file only from a Directory

Hi, I am using the below query to find files from a Directory: SOURCE_DIR--Directory Files in the Directory: ABC.log XYZ.out The SOURCE_DIR has subdirectory.... when i use the below command... find /apps/informatica/node1/scripts/test '(' -name '*.log' -o -name '*.out'... (12 Replies)
Discussion started by: ch33ry
12 Replies

5. Shell Programming and Scripting

Find file directory

Hi, I am using the below command for searching the file var_SearchFile= find $var_DataSourcePath -name $var_SourceFileName Output: c:\test\Sample\Testfile.txt But I need to retrive only the Path that is "c:\test\Sample\" (8 Replies)
Discussion started by: magesh_bala
8 Replies

6. UNIX for Dummies Questions & Answers

Granting user permission for public_html

I have problem giving user access to his public_html directory. While when I am logged as root I can access my files by going to www.myserver.com/file.htmlwhere file.html is actually on this path... var/www/file.htmlBut when user tries to access his file.html on this path.... ~user/file.html it... (10 Replies)
Discussion started by: joker40
10 Replies

7. Shell Programming and Scripting

Find file in a directory

Hi, I'm trying to write a script that search file in folder. I got problems with selecting specific file from the list of the files. when I runing the script I get a list of files instead of one specific file. I'm new with linux :) #!/bin/bash FILE=false ISFOUND=false while getopts... (6 Replies)
Discussion started by: SimonBASH
6 Replies

8. AIX

find for specific content in file in the directory and list only file names

Hi, I am trying to find the content of file using grep and find command and list only the file names but i am getting entire file list of files in the directory find . -exec grep "test" {} \; -ls Can anyone of you correct this (2 Replies)
Discussion started by: madhu_Jagarapu
2 Replies

9. UNIX for Dummies Questions & Answers

how to find a file named vijay in a directory using find command

I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem. so i need to use find command (6 Replies)
Discussion started by: amirthraj_12
6 Replies

10. UNIX for Dummies Questions & Answers

chmod for public_html ?

Hello! My web host has the public_html permission on my account set to 750. 1. Does this setting permit the world to use my submission forms (contained within contact.html and purchase_order.html)? 2. The "0" entry looks like it blocks the public from conducting all activity on my site.... (6 Replies)
Discussion started by: Texan
6 Replies

Featured Tech Videos