The Computer Oracle

How to find a directory on linux?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: The World Wide Mind

--

Chapters
00:00 Question
00:39 Accepted answer (Score 776)
01:04 Answer 2 (Score 76)
01:32 Answer 3 (Score 36)
01:52 Answer 4 (Score 19)
02:37 Thank you

--

Full question
https://superuser.com/questions/327762/h...

Answer 3 links:
http://www.sysadmit.com/2015/12/linux-bu...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #commandline

#avk47



ACCEPTED ANSWER

Score 874


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




ANSWER 2

Score 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



ANSWER 3

Score 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.




ANSWER 4

Score 10


you almost have it. the correct syntax would be:

find / -type d -name httpdocs

The directory is likely under /var/www/