Remove ^C when CTRL+C

Is there any way to remove ^C when you hit CTRL+C in the shell include with Red Hat Enterprise Linux 6 (“Santiago”)? I have permission to edit my own .bash_profile.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Edit (or create) your ~/.inputrc file. Add a line saying

set echo-control-characters Off

This will instruct the GNU Readline library (which Bash uses) to not output (echo) any control characters to the screen. The setting will be active in all new Bash sessions thereafter (and in any other utility that uses the Readline library).

Notice that if your Unix system comes with a system-wide configuration file for the Readline library (usually /etc/inputrc), then your personal configuration file will need to include that file:

$include /etc/inputrc
set echo-control-characters Off

Another alternative is to make a personal copy of the system-wide configuration file and then modify that.

Method 2

Try the following:

stty -echoctl

For an explanation see this great and detailed post from Stéphane Chazelas which also explains some other stty features.

If you want to make that change permanent (and you are using bash as implied in your question) then it’s best to put into your .bashrc as noted by jlmg in the comments (so it applies to all interactive shells).

Method 3

If you’re trying to find a configuration that will allow normal echoing (including echoctl) and just silence the echoing of signal-generating characters, and you’re sure it should be possible because you’ve seen it work that way before…

You probably have seen it that way. But it’s no longer possible, because of this commit:

commit ec5b1157f8e819c72fc93aa6d2d5117c08cdc961

Turn on INTR/QUIT/SUSP echoing in the N_TTY line discipline (e.g. ctrl-C will appear as “^C” if stty echoctl is set and ctrl-C is set as INTR).

Linux seems to be the only unix-like OS (recently I’ve verified this on Solaris, BSD, and Mac OS X) that does not behave this way, and I really miss this as a good visual confirmation of the interrupt of a program in the console or xterm. I remember this fondly from many Unixs I’ve used over the years as well. Bringing this to Linux also seems like a good way to make it yet more compliant with standard unix-like behavior.

If you remember fondly how Linux used to not echo that ^C, the only way to get the old behavior back is to patch your kernel. In recent versions, the echoing of signal-generating characters is at lines 1215-1218 of drivers/tty/n_tty.c.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments