Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I find a particular directory in a terminal window in Linux? I think it involves using grep, but I'm not sure how.

share|improve this question
removing find-in-files tag since you are locating a directory, no file-content-search is implied. – nik Jul 2 '10 at 5:44
What do you know about the directory that would allow you to find it? – David Z Jul 2 '10 at 5:58
you have to provide at least some search criteria, "particular" is a bit vague. one can find items on the disc based upon names, relation ships, sizes, content, etc etc. – akira Jul 2 '10 at 7:16
up vote 28 down vote accepted

Would you be looking for something like this?

find . -type d | grep DIRNAME
share|improve this answer
what's wrong with find . -name DIRNAME -type d? – Benjamin Bannier Jul 2 '10 at 5:47
@honk, Nothing :-) -- the OP seems to like grep; and we all like variety – nik Jul 2 '10 at 5:51
whats the difference? – Dobler May 22 '15 at 5:13
Five years later I did notice the answer in the comment was slower to process than the original answer. Maybe a glitch. Anyone? Bueller? – aCodeSmith Jun 17 '15 at 3:45

If you want to find a particular directory that might be anywhere on your computer, the following will work, but it might take a while.

find / -name DIRNAME -type d
share|improve this answer
And, if you want to find within the working directory -- replace '/' with '.' -- could get quicker. – nik Jul 2 '10 at 5:52

If you have it installed, locate is designed for this. Google "man locate"

share|improve this answer
Though locate won't provide you real-time results, but instead returns the results it gathered while updatedb was last run. If the filesystem doesn't change much, then it isn't a real problem and locate is very fast. – Janne Pikkarainen Jul 29 '10 at 11:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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