Shell – How to Remove ^C When Pressing CTRL+C

shell

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.

Best Answer

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.