0

My terminal does not display ^C when I press CTRL-C in my terminal. I have tried setting various STTY options and am not sure what is wrong.

I am running Mac OSX 10.11.16 and this phenomenon occurs in the Terminal app as well as the iTerm2 terminal emulator. I am not sure where I am going wrong. Here is the output of stty -a:

speed 38400 baud; 39 rows; 171 columns;
lflags: icanon isig iexten echo echoe echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -iutf8
    -ignbrk brkint -inpck -ignpar -parmrk
oflags: opost onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
    min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
    stop = ^S; susp = ^Z; time = 0; werase = ^W;
3

This depends on the software, and is not consistent. Some shells will merely advance the prompt, others will show the desired ^C (and possibly then exit), and others will emit something besides ^C:

%
%
% tclsh
tclsh> ^C
% clisp
[1]> 
*** - Ctrl-C: User break

[2]> 
% perl -MTerm::ReadKey -E 'ReadMode "raw"; $k=ReadKey(0);' \
  -E 'say "control+c" if $k eq "\003"; ReadMode "restore"'
control+c
% 
  • This ended up being correct: I updated to Bash 4.4 (from 3.x) and it is displaying "^C" now. – Jrop Oct 18 '16 at 21:22

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.