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?

Edward Tanguay
  • 13,695
  • 37
  • 102
  • 128
  • 5
    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

5 Answers5


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

  • 52,568
  • 14
  • 124
  • 170
  • 8,084
  • 1
  • 16
  • 6
  • 103
    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
  • 15
    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
  • 25
    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
  • 24
    I would append 2> /dev/null to avoid having my search results getting hidden in all the permission errors. – Jason Yeo Aug 21 '13 at 06:48
  • I prefer `iname`. – neverMind9 Jul 04 '19 at 14:47
  • Are the single quotes necessary 'directory name' ? – Simon Sep 15 '20 at 15:26

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
  • 2,257
  • 17
  • 19
  • locate httpdocs tells me "locate: command not found" – Edward Tanguay Jun 28 '09 at 18:36
  • 4
    For those using the "locate" command (given that it exists in your system), make sure that that database it looks up is up-to-date; normally some cron job takes care of it. Otherwise, run "updatedb" (being root). Then run your needed "locate ". This is necessary for finding recently added files/dirs. – David Ramirez Nov 02 '12 at 23:23
  • 3
    +1 for locate. It's *a lot* faster but only if its index is up to date. Fortunately, something like "httpdocs" won't change location frequently. If you're planning on repeatedly searching for files on a machine, it's worth the few minutes needed to set up the updatedb cron job. – Doug Harris Mar 25 '13 at 18:57
  • 2
    Also in many cases, locate will return too many results since all 100k files in that directory will show up. In this particular case if every user has their own httpdocs with 100's or 1000's of files the result the OP wants will probably be lost. – Jistanidiot Jul 16 '14 at 12:46
  • +1 for locate... I keep my database updated so this command is very useful... Great idea. – nicorellius Aug 25 '14 at 23:01
  • I've never looked into it, but updatedb/locate does not index all partitions on all drives, so it doesn't always find things that are there. If what you want is (mounted) under /, it should find it, but if it's on another partition, it probably won't. – Joe Jan 12 '16 at 01:55
  • `locate -b foldername`? – endolith May 03 '21 at 15:13
  • `locate` is a lifesaver! I would recommend trying it before trying anything else. – Arka Mukherjee Jun 16 '22 at 05:32
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.

  • 471
  • 4
  • 2
  • 5
    The `2> /dev/null` option is very helpful. Otherwise it can be hard to see the wanted results... – Gottlieb Notschnabel Feb 14 '14 at 18:59
  • See also [How can I exclude all “permission denied” messages from “find”?](http://stackoverflow.com/questions/762348/how-can-i-exclude-all-permission-denied-messages-from-find) – galath Mar 10 '17 at 10:06

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:


  • 191
  • 1
  • 2
  • This question is about how to find a directory whose name you know, not how to find a directory whose name you know (approximately).  Besides, the accepted answer (from over 6 years ago!) already mentions `-iname` as a case-insensitive alternative to `-name`. – G-Man Says 'Reinstate Monica' Dec 07 '15 at 05:23

you almost have it. the correct syntax would be:

find / -type d -name httpdocs

The directory is likely under /var/www/

  • 155
  • 1
  • 2
  • 8