Find a file by name using command-line

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.

Goodluck


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.


The other answers are good, but I find omitting Permission denied statements gives me clearer answers (omits stderrs due to not running sudo):

find / -type f -iname "*postgis-2.0.0*" 2>/dev/null

where:

  • / can be replaced with the directory you want to start your search from
  • f can be replaced with d if you're searching for a directory instead of a file
  • -iname can be replaced with -name if you want the search to be case sensitive
  • the *s in the search term can be omitted if you don't want the wildcards in the search

An alternative is:

find / -type f 2>/dev/null | grep "postgis-2.0.0"

This way returns results if the search-term matches anywhere in the complete file path, e.g. /home/postgis-2.0.0/docs/Readme.txt