How to exit from PostgreSQL command line utility: psql How to exit from PostgreSQL command line utility: psql postgresql postgresql

How to exit from PostgreSQL command line utility: psql


Type \q and then press ENTER to quit psql.

UPDATE: 19-OCT-2018

As of PostgreSQL 11, the keywords "quit" and "exit" in the PostgreSQL command-line interface have been included to help make it easier to leave the command-line tool.


My usual key sequence is:

quit()quitexit()exitqq()!q^ChelpAlt + Tabgoogle.comQuit PSQL\q

I think veterans of the psql command line usually shorten that to just:

\q


Ctrl+D is what I usually use to exit psql console.