How To Find The Port PostgreSQL Is Listening On

To determine which port PostgreSQL is listening on, you can use the ‘SHOW port’ command as follows:

sudo su postgres -c "psql -c 'SHOW port;'"