51
19
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.
51
19
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.
72
Would you be looking for something like this?
find . -type d | grep DIRNAME
whats the difference? – Dobler – 2015-05-22T05:13:21.567
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 – 2015-06-17T03:45:05.810
21what's wrong with find . -name DIRNAME -type d
? – Benjamin Bannier – 2010-07-02T05:47:50.027
4@honk, Nothing :-)
-- the OP seems to like grep
; and we all like variety – nik – 2010-07-02T05:51:15.200
27
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
5And, if you want to find
within the working directory -- replace '/
' with '.
' -- could get quicker. – nik – 2010-07-02T05:52:38.597
2
If you have it installed, locate
is designed for this.
Google "man locate"
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 – 2010-07-29T11:12:07.240
-1 Locate is designed to find files, not directories. Or is there an option I am not aware of? – Martin R. – 2017-07-13T16:26:17.550
locate works just fine for directories. – TREE – 2017-07-13T19:10:37.157
removing
find-in-files
tag since you are locating a directory, no file-content-search is implied. – nik – 2010-07-02T05:44:32.297What do you know about the directory that would allow you to find it? – David Z – 2010-07-02T05:58:48.350
1you 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 – 2010-07-02T07:16:38.060