Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

I am trying to find a directory, using the terminal and I am not sure where it is. I mean that i used the wget command to obtain the file and used it for installation and now i am not able to find where I kept it.

I did try,

find . -type f -name "postgis-2.0.0"


locate postgis-2.0.0

But with no luck. What is the command to find a directory in your desktop?

share|improve this question
the locate command is fine, just update the locatedb first, using command updatedb – thucnguyen May 18 at 3:53
up vote 79 down vote accepted

Try find ~/ -type f -name "postgis-2.0.0" instead.

Using . will only search the current directory. ~/ will search your entire home directory (likely where you downloaded it to). If you used wget as root, its possible it could be somewhere else so you could use / to search the whole filesystem.


share|improve this answer
oh ya i used wget as root so / worked thanks – Sam007 May 31 '12 at 17:09
@Sam007 Glad to have helped. If this answer solved your problem you can accept it using the check mark to the left of it. Edit: although I actually like reverendj1's answer better... so maybe upvote me if it worked and give him the accepted answer :P – adempewolff May 31 '12 at 17:11
ya actually I tried earlier and it said that I can accept it only after 8 min so I can now and voila!! – Sam007 May 31 '12 at 17:23
lol, I gave you an upvote, since ur completely right and marked as anser, and I felt bad seeing didnt got upvoted xD – Dr_Bunsen May 31 '12 at 17:45

I would try:

sudo find / -type d -name "postgis-2.0.0"

The . means search only in the current directory, it is best to search everything from root if you really don't know. Also, type -f means search for files, not folders. Adding sudo allows it to search in all folders/subfolders.

Your syntax for locate is correct, but you may have to run

sudo updatedb

first. For whatever reason, I never have good luck with locate though.

locate uses database of files and directories made by updatedb. So if you have downloaded a new file there is more chance that your updatedb has not updated the database of files and directories. You can use sudo updatedb before using locate utility program. updatedb generally runs once a day by itself on linux systems.

share|improve this answer

find is one of the most useful Linux/Unix tools.

Try find . -type d | grep DIRNAME

share|improve this answer
Is there any advantage here to using grep over -name ? – oooooo Feb 1 at 23:40

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.