如何退出PostgreSQL命令行实用程序:psql

本文翻译自: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 如果根本不需要用户输入
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值