Home How to exit from PostgreSQL command line utility: psql

# How to exit from PostgreSQL command line utility: psql

App Work
1#
App Work Published in 2012-02-27 10:17:44Z
 What command or short key can I use to exit the PostgreSQL command line utility psql?
Frankline
2#
 Type \q and then press ENTER to quit psql.
rink.attendant.6
3#
 Ctrl+D is what I usually use to exit psql console.
Ted
4#
 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 
sflitman
5#
 I learned that I could include \q in a batch .sql file, so I could have psql quit earlier from an \i operation.
Maurice Elagu
6#
Maurice Elagu Reply to 2015-10-21 09:34:46Z
 For Linux command line \q + enter. Quiting with Ctrl + D also is works
iusting
7#
 Try: Ctrl+Z - this sends the TSTP signal (TSTP is short for “terminal stop”) Ctrl+\ - this sends the QUIT signal For curiosity: Ctrl+D - this sends the EOF character. EOF stands for "end of file". In this concrete case it exits from the psql subprogram, as the shell is waiting for user input. This should not be 'the way to go' as it is not working if: any other character is entered before - try entering some white spaces and then press Ctrl+D, it's not going to exit psql. if the user input is not required at all
 You need to login account before you can post.
Processed in 0.311395 second(s) , Gzip On .