656

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?

Franck Dernoncourt
  • 24,246
  • 64
  • 231
  • 400

5 Answers5

879

It is:

find / -type d -name 'httpdocs'

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

terdon
  • 54,564
OldJim
  • 9,034
86

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
Zypher
  • 2,357
40
find / -type d -name httpdocs 2> /dev/null

This will eliminate all the error messages you'll likely (read, always) get when not doing this as the root user. Would recommend doing it this way.

20

It's important to know the parameter -iname to search "case insensitive" patterns and the use of wildcards: *, ?, etc..

Two examples:

Search all files from /root that contains the string "Linux", case insensitive:

find  /root -type f -iname "*linux*"

Search all directories from /root that contains the string "Linux", case insensitive:

find  /root -type d -iname "*linux*"

Extracted from here:

http://www.sysadmit.com/2015/12/linux-buscar-ficheros-directorios-con-find.html

LunaSeven
  • 201
10

you almost have it. the correct syntax would be:

find / -type d -name httpdocs

The directory is likely under /var/www/