use*_*786 8 ubuntu keyboard-shortcuts terminal interrupt gnome-terminal
我一直在寻找答案,到目前为止还没有找到可以回答我的问题的答案。我目前正在登录我的 Ubuntu 服务器,并且在运行一个进程时,我无法在其上运行任何中断。这是我的 stty -a:
user@Ubuntu1:~$ stty -a
speed 38400 baud; rows 93; columns 200; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 1; time = 0;
Run Code Online (Sandbox Code Playgroud)
我的 .bashrc 中没有任何内容可以更改中断。
这对于包括 root 在内的所有用户都是一样的。我还尝试使用不同的终端从不同的位置登录,每次都出现相同的结果。我已经使用 ssh 和 ssh -X 登录。
编辑:在本地我所有的中断工作正常。
更新:我仍在寻找答案。我的朋友有完全相同的问题。问题似乎很重要,当登录(从 PC、Mac、Linux)时,键盘没有选择这些键(即使正确映射)。
ctrl+c永远不会杀死程序,
POSIX 标准定义了一组信号,这些信号用于控制正在运行的程序。
First the signals described in the original POSIX.1-1990 standard.
Signal Value Action Comment
??????????????????????????????????????????????????????????????????????
SIGHUP 1 Term Hangup detected on controlling terminal
or death of controlling process
SIGINT 2 Term Interrupt from keyboard
SIGQUIT 3 Core Quit from keyboard
SIGILL 4 Core Illegal Instruction
SIGABRT 6 Core Abort signal from abort(3)
SIGFPE 8 Core Floating point exception
SIGKILL 9 Term Kill signal
SIGSEGV 11 Core Invalid memory reference
SIGPIPE 13 Term Broken pipe: write to pipe with no
SIGTERM 15 Term Termination signal
Run Code Online (Sandbox Code Playgroud)
- http://man7.org/linux/man-pages/man7/signal.7.html
ctrl+c向2
您从终端运行的程序发送信号,“从键盘中断”。
完全由程序来处理该信号,它可以为所欲为。许多脚本语言解释器可以通过杀死被调用的脚本并正常退出来以默认方式处理这个问题。
如果您希望程序退出,特别是从自动上下文中退出,建议使用 singal 15,该kill
程序可用于通过 id (pid) 向进程发送信号。
kill -15 <pid>
Run Code Online (Sandbox Code Playgroud)
据我所知,程序本身仍然接收到这个信号,并且应该尽可能干净地终止。
如果程序忽略信号 15,并且程序继续存在(并且您不会由于权限错误而无法发送信号)
kill -9 <pid>
Run Code Online (Sandbox Code Playgroud)
据我所知,信号 9 由内核(任务管理器和硬件接口)解释,内核突然停止处理程序,并取消分配/释放其所有资源。
小智 0
Ctrl+c 不会终止该进程。它只会在中间停止当前正在运行的进程。要终止进程,我们需要使用“KILL”命令
归档时间: |
|
查看次数: |
14385 次 |
最近记录: |