psql -d appdb -c '\conninfo'

Category: Databases & SQL

psql -d appdb -c '\conninfo'

Show current connection details

Prints user, database, host, port, and whether the session uses a Unix socket or TCP. The fastest way to confirm which server you actually reached when proxies or multiple clusters are involved.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.