本文翻译自:How to exit from PostgreSQL command line utility: psql
我可以使用什么命令或短键来退出PostgreSQL命令行实用程序psql
?
#1楼
参考:https://stackoom.com/question/dhqA/如何退出PostgreSQL命令行实用程序-psql
#2楼
Ctrl + D是我通常用来退出psql控制台的东西。
#3楼
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: 我认为psql命令行的老手通常会将其简化为:
\q
#4楼
我了解到我可以在批处理.sql文件中包含\\ q,所以我可以在\\ i操作之前让psql退出。
#5楼
For Linux command line \\q + enter. 对于Linux命令行\\ q + 输入。
Quiting with Ctrl + D also is works 使用Ctrl + D退出也是有效的
#6楼
Try: 尝试:
- Ctrl + Z - this sends the
TSTP
signal (TSTP
is short for “terminal stop”) Ctrl + Z - 发送TSTP
信号(TSTP
是“终端停止”的缩写) - Ctrl + \\ - this sends the
QUIT
signal Ctrl + \\ - 这会发送QUIT
信号
For curiosity: 好奇心:
- Ctrl + D - this sends the
EOF
character. Ctrl + D - 这将发送EOF
字符。EOF
stands for "end of file".EOF
代表“文件结束”。 In this concrete case it exits from the psql subprogram, as the shell is waiting for user input. 在这个具体的情况下,它从psql子程序退出,因为shell正在等待用户输入。 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. 之前输入任何其他字符 - 尝试输入一些空格然后按Ctrl + D ,它不会退出psql。
- if the user input is not required at all 如果根本不需要用户输入