A Postgres configuration file can exist in any location. It defaults to the data directory in the CentOS or RedHat family of operating systems and defaults to /etc/postgresql/${pg_major_version}/main in Debian/Ubuntu operating systems, where pg_major_version is the major version of PostgreSQL that is installed. For PostgreSQL 12, it looks like /etc/postgresql/12/main/postgresql.conf. However, it is easier to modify the default location and store it in a different location. In this recipe, we will discuss how to locate the postgresql.conf configuration files that's created for a specific PostgreSQL instance.
Getting ready
To locate the configuration file, we must either have an already running PostgreSQL server or an existing data directory, using which PostgreSQL would have been initialized or started/running already.
How to do it...
Follow these steps to complete this recipe:
- Search for the value set of the config_file parameter:
$ psql...