1

I installed postgresql from the package manager

sudo apt-get install postgresql postgresql-contrib

and I want to know what files it installed, including any startup scripts or modifications to any shell scripts.

When I run dpkg-query, this is the output:

# dpkg-query -L postgresql
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/postgresql
/usr/share/doc/postgresql/changelog.gz
/usr/share/doc/postgresql/copyright

As you can see, it is not listing a lot of the crucial files, including (but not limited to):

/usr/lib/postgresql (the binaries)
/var/lib/postgresql (the data directory and the database initialization via initdb)
/etc/postgresql (the configuration files)
/var/log/postgresql (the log file)

Also I want to know what changes it made to global startup scripts in order for it to be loaded when operating system starts.

Why are all these important details missing from the output of dpkg-query and how can I list this information?

1 Answer 1

4

So what is the problem?

Back to Installation

$ sudo apt-get install postgresql postgresql-contrib

will give you a prompt

The following NEW packages will be installed:
  postgresql postgresql-9.1 postgresql-client-9.1 postgresql-client-common
  postgresql-common postgresql-contrib postgresql-contrib-9.1

So you have to know not all of your specified files is just related to postgresql instead you should search for all of those packages

dpkg-query -L postgresql postgresql-9.1 postgresql-client-9.1 postgresql-client-common postgresql-common postgresql-contrib postgresql-contrib-9.1

So now you can find all of your files.

To prove what I'm saying

 $ dpkg -S /usr/lib/postgresql/9.1/bin/psql

postgresql-client-9.1: /usr/share/postgresql/9.1/man/man1/psql.1.gz
postgresql-client-common: /usr/bin/psql
postgresql-client-9.1: /usr/share/postgresql/9.1/psqlrc.sample
postgresql-client-9.1: /usr/lib/postgresql/9.1/bin/psql

This is a sample of a files in /usr/lib/postgresql/* and it proves it is not in the postgresql package, so you have what package to search for

Thanks to @steeldriver comment:

In addition, there may be files that are not part of any package's contents, but are instead created on-the-fly by a post-install (postinst) script - and removed by the corresponding postrm script upon package removal.

3
  • 1
    In addition, there may be files that are not part of any package's contents, but are instead created on-the-fly by a post-install (postinst) script - and removed by the corresponding postrm script upon package removal. Jun 1, 2015 at 15:58
  • Is there a command to find out the related packages installed after installation? Above you show that it lists the related packages with a prompt. But what if you want to know the said packages after installation?
    – Donato
    Jun 2, 2015 at 5:39
  • @Donato you can user apt-cache rdepends package-name
    – Maythux
    Jun 2, 2015 at 5:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .