6

When I press Ctrl-C in any pseudoterminal (xterm, gnome-terminal, rxvt, text console and SSH) in Karmic Koala, the string ^C gets echoed to the terminal in Ubuntu Karmic Koala. This hasn't happened in Ubuntu Jaunty Jackalope. I'd like to get rid of the extra ^C. Example:

$ cat
foo
foo
^C
$ _

I got the above by typing C, A, T, Enter, F, O, O, Enter, Ctrl-C. I want to get rid of the ^C, and get this for the same keypresses:

$ cat
foo
foo

$ _

I tried setting stty -echoctl, which solved the problem for rxvt and xterm outside SSH, but it created a single-character HT when SSHing from an Ubuntu Hardy system, and it created a box with Unicode 0003 in it instead of the ^C in gnome-terminal. I want to see absolutely nothing when I press Ctrl-C. I'm using

Linux linux 2.6.31-20-generic-pae #57-Ubuntu SMP Mon Feb 8 10:23:59 UTC 2010 i686 GNU/Linux

I have these terminal settings in all systems and all terminal emulators:

ioctl(0, TCGETS, {c_iflags=0x2502, c_oflags=0x5, c_cflags=0xbf, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"})
5
  • possible duplicate of Prevent "^C" from being printed when aborting editing current prompt
    – Nifle
    Commented May 30, 2010 at 18:16
  • Yes, it's related, but it's not a duplicate. In my question I don't care about the prompt (bash or zsh), but I care about the cat command. The solution there doesn't hide the escape sequence from the cat command in gnome-terminal.
    – pts
    Commented May 31, 2010 at 0:29
  • Please add the output of stty -a. Your ioctl data is hard to read (where did that come from, by the way?). Commented May 31, 2010 at 11:06
  • speed 38400 baud; rows 24; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd 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
    – pts
    Commented Jun 6, 2010 at 21:17
  • Why get rid of it? It has to be like that :-( It always has been.
    – nisc
    Commented Sep 7, 2010 at 11:41

2 Answers 2

8

Do this and record the results:

stty -a

Then try:

stty sane
stty -echoctl

Then if Ctrl-C works the way you expect:

stty -a

and compare the results to the ones you recorded above.

Edit:

This has been filed as a bug against gnome-terminal. You can produce similar behavior with printf '\003\n'. PuTTY and xterm display a blank line, but gnome-terminal displays a Unicode box.

6
  • stty sane; stty -echoctl seems to work for xterm and rxvt, but I still get the 0003 character in gnome-terminal, and I still get the HT character if I ssh to this system from an Ubuntu Hardy ... Ubuntu Jaunty system. So I can't accept your solution.
    – pts
    Commented May 31, 2010 at 0:31
  • @pts: interesting. that solution does work with your cat example on Ubuntu 10.04 within a screen session in a gnome-terminal, but doesn't in the bare gnome-terminal (i get the Unicode 0003 character). no difference in stty -a; the only difference is the TERM value (xterm for the bare gnome-terminal; screen within the screen session). Commented May 31, 2010 at 0:53
  • 1
    This has been filed as a bug against gnome-terminal. You can produce similar behavior with printf '\003\n'. PuTTY and xterm display a blank line, but gnome-terminal displays a Unicode box. Commented May 31, 2010 at 2:19
  • This is more than a gnome-terminal bug, because I get the HT character when SSHing from Ubuntu Hardy to Ubuntu Karmic inside an xterm.
    – pts
    Commented May 31, 2010 at 8:38
  • @pts: What is an HT character? Horizontal Tab is 0x09 (\011) not 0x03 (intr/interrupt/ASCII ETX). I think I overlooked that issue in your original question. Are you getting a Unicode box 0009 when you do that? What is the other text surrounding it or what other information can you provide? This problem would be somewhat different from the ^C problem. Can you add a screen capture to your question? Commented May 31, 2010 at 11:01
1

Prevent "^C" from being printed when aborting editing current prompt

1
  • 3
    the answer to that question says "do stty -echoctl ..." which this poster has already tried. Commented May 30, 2010 at 18:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .