4

I have been using Ctrl+C on most terminals to easily cancel the line I was writing and open the way for a new line. (I'm not talking about killing a running bash script, but just opening a new blank line) For no reason I can think of, this functionality just got turned off on a remote shell opened by SSH.

Ctrl+C will work on most other cases (like killing a running script, exiting VIM insert mode) but will no longer skip the line and go to the next on in the regular shell.

This is a shell running on Amazon linux 2, but I never had this issue on other Amazon Linux 2 machines, so it's probably coming from something I did...

Any idea what might have happened and how I can fix it ?

In the meantime I'm stuck pressing the delete key, which despite putting key repeat time to the minimum, is still quite slow.

EDIT -

I connect to the terminal using SSH, and this is interesting : if I open a new shell inside my SSH terminal (using bash) then CTRL+C works again !

6
  • Are you sure the terminal emulator is not binding this key? – Konrad Gajewski Sep 3 '18 at 19:57
  • You can try to use Ctrl+U, which should delete everything left of the cursor. – sticky bit Sep 3 '18 at 22:19
  • Does the problem persist if you open a new terminal window and try again? – kasperd Sep 21 '18 at 8:00
  • @kasperd I connect to the terminal using SSH, however and this is interesting, if I open a new shell inside my SSH terminal (using bash then CTRL+C works again !) – Cyril Duchon-Doris Sep 21 '18 at 15:29
  • @CyrilDuchon-Doris Not sure how you run ssh then. I always open a terminal and type an ssh command in that terminal. – kasperd Sep 21 '18 at 16:24
4

To fix it you can use the stty command to reset it.

$ stty intr \^c

To see what intr is currently set you can use:

$ stty -a 

$ stty -a

speed 38400 baud; rows 21; columns 161; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc ixany imaxbel iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

The function of intr is described in the man page as:

intr CHAR

CHAR will send an interrupt signal

https://linux.die.net/man/1/stty

2
  • 1
    Hey, the command stty intr \^c does not solve my issue :/. I also see intr = ^C; quit = ^\ in the output of my stty -a command – Cyril Duchon-Doris Sep 21 '18 at 15:30
  • 1
    @CyrilDuchon-Doris I see you're using iterm2, there are several references to Ctrl-c not working with iterm2. Search them and see if they fix your issue. – kenlukas Sep 26 '18 at 1:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.