How do I search for a file or directory in Ubuntu Server?

Solution 1:

You name it: locate!

locate is a program installed by default that let you search for files/dirs by name, into its database updated with a cron job.

Go through the man page to see other interesting options, like regex search.

Moreover, you can use find to search on the current content of the filesystem (not on a database), with a full set of complicated options, that let you refine your search also based on metadata (permissions, modification time, etc.).

Solution 2:

The command find / -name "name-to-search-for" seem to work fine. A good thing was to add a * in the end or at the beginning of the name.

E.g. find / -name "postgresql*" list files and directories that starts with "postgresql".

Solution 3:

If you are installing and want to know what files you install... you can do that immediately following an install by doing the following:

touch marker
find <directorypath> -newer marker

There are some situations in which you will get results other than the newly installed applications(s):

  • if Firefox or another browser is running there may be updated files
  • if Virtualbox or other virtualization guest is running its virtual disk file may have been altered.

This method should work with installs from .deb files or scripted installs.

NOTE:

  • Do not use this from the 'root' directory as there are many system files that are updated frequently.