It's often that I need to locate the path to files and directories in Ubuntu Server. Are there any good way to search for files or directories in the filesystem by name?
It's often that I need to locate the path to files and directories in Ubuntu Server. Are there any good way to search for files or directories in the filesystem by name?
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.).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".If you are installing and want to know what files you install... you can do that immediately following an install by doing the following:
There are some situations in which you will get results other than the newly installed applications(s):
This method should work with installs from .deb files or scripted installs.
NOTE:
According to your comments, you are not looking for specific filenames but for files that belong to a package. To see which files are associated with your installed package just type:
dpkg -L postgresql-contrib-8.4