I have a VPS with Suse Linux 10.3.

I've logged in via SSH/putty and am trying to find where my web files are located.

Since I'm uploading via FTP in a directory called httpdocs, I assume that this directory exists somewhere.

My google searches have taught me to do this, go to my root directory and type:

find httpdocs -type d

but it says "No such file or directory".

How can I find this directory?

link|improve this question

In case someone's wondering, the command in the question finds all directories (-type d) in the directory entry httpdocs (relative to the current working directory, usually but not necessarily a directory). It fails with error message because there is no directory entry httpdocs in the system's root directory, and therefore no starting point for a search. – Daniel Beck Dec 30 '11 at 12:56
feedback

migrated from serverfault.com Aug 25 '11 at 2:31

This question came from our site for system administrators and desktop support professionals.

5 Answers

up vote 46 down vote accepted

It is:

find / -name 'httpdocs' -type d

the first parameter "/" is where to look, in this case "/" it's the entire system.

-name could be -iname to ignore case

also -type is not mandatory

use : man find for more options

link|improve this answer
find / -name 'httpdocs' works great thanks – Edward Tanguay Jun 28 '09 at 18:35
7  
It may not matter for simple searches, but for more complex find commands, it's worth noting that things are evaluated in the order they are on the commandline. So, you might want to have the -type d (directories only) before -name, in order to speed things up. Again, this may not matter much here, but when getting into more complex searches it can improve search speed considerably. – Dominic Eidson Jun 28 '09 at 19:00
... that is a really useful thing to know, thanks dominic! – Sirex Jan 24 '11 at 17:52
2  
Actually, the -name test is faster than most of the other tests since -name is matched against the directory's listing, which is already loaded from disk, and the other tests need to perform a stat(2) to get file information. After the first stat() call for a file, an subsequent tests get from memory, e.g.: -type f -mtime -10. – Arcege Dec 30 '11 at 12:53
1  
If you are going to perform a find on the entire filesystem, especially a server, then it is usually good to use nice so the find doesn't take too many resources from more critical processes: nice find / ... – Arcege Dec 30 '11 at 12:54
feedback

this command should get you what you are looking for:

find / -type d -name httpdocs

that will search from the root of your server for directories with the name of httpdocs or if you just want to search from the current directory replace the '/' with a '.'

Another command you can try is locate you would do something like:

locate httpdocs
link|improve this answer
locate httpdocs tells me "locate: command not found" – Edward Tanguay Jun 28 '09 at 18:36
feedback

find / -name 'httpdocs' -type d

locate httpdocs

/var/www/ location

link|improve this answer
+1 for locate – Arcege Dec 30 '11 at 13:21
feedback

you almost have it. the correct syntax would be:

find / -type d -name httpdocs

The directory is likely under /var/www/

link|improve this answer
that tells me "paths must precede expression" – Edward Tanguay Jun 28 '09 at 18:12
feedback

carpetaBusqueda='/'

nombreCarpetaBuscada='httpdocs'

sudo find "$carpetaBusqueda" -name "$nombreCarpetaBuscada" -type d

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.