Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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"})
share|improve this question
    
possible duplicate of Prevent "^C" from being printed when aborting editing current prompt –  Nifle May 30 '10 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 May 31 '10 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?). –  Dennis Williamson May 31 '10 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 Jun 6 '10 at 21:17
    
Why get rid of it? It has to be like that :-( It always has been. –  nisc Sep 7 '10 at 11:41

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer
    
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 May 31 '10 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). –  quack quixote May 31 '10 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. –  Dennis Williamson May 31 '10 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 May 31 '10 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? –  Dennis Williamson May 31 '10 at 11:01

http://superuser.com/questions/146815/prevent-c-from-being-printed-when-aborting-editing-current-prompt

share|improve this answer
3  
the answer to that question says "do stty -echoctl ..." which this poster has already tried. –  quack quixote May 30 '10 at 18:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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