This command will give you the postgres port number
\conninfo
If postgres runs on a Linux server, you can also use the following command
sudo netstat -plunt |grep postgres
OR (if he comes as postmaster)
sudo netstat -plunt |grep postmaster
and you will see something like this
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 140/postgres tcp6 0 0 ::1:5432 :::* LISTEN 140/postgres
in this case, the port number is 5432, which is also the default port number
credit reference
Khaino Jun 24 '16 at 10:36 2016-06-24 10:36
source share