Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exit from PostgreSQL command line utility: psql

What command or short key can I use to exit the PostgreSQL command line utility psql?

like image 803
App Work Avatar asked Feb 27 '12 10:02

App Work


People also ask

How do I exit out of PostgreSQL command line?

Exiting psql Using a Meta-Command The meta-command for exiting psql is \q .

How do I clear the screen in PostgreSQL?

Use \! cls to clear screen.

What is psql command line tool?

Description. psql is a terminal-based front-end to PostgreSQL. It enables you to type in queries interactively, issue them to PostgreSQL, and see the query results. Alternatively, input can be from a file or from command line arguments.


2 Answers

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.

like image 118
Frankline Avatar answered Sep 21 '22 08:09

Frankline


My usual key sequence is:

quit() quit exit() exit q q() !q ^C help Alt + Tab google.com Quit PSQL \q 

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

\q 
like image 20
Ted Avatar answered Sep 21 '22 08:09

Ted