PostgreSQL provides an interactive command line utility for it’s users. Mostly it’s called as psql. You can run SQL queries from psql command line tool, also statements like \d too. In this article we are going to cover how to exit from PostgreSQL command line.
Answer of question “how to exit from PostgreSQL command line?” changes between the versions. Not a deep change, but new options added after PostgreSQL 11. Alright, let’s try to answer question, how to exit psql command line.
Simply:
\q
PostgreSQL’s backslash commands are very useful (like \d, \dt etc.) You can use \q to quit psql’s command line.

As an alternative you can use quit and exit too:
quit

exit

As you see, there are three most common options to exit from PostgreSQL command line.
If you have a question or something to add, please leave a comment below.



Leave a Reply