I have the habit of using ctrl
+ c
as a quick way to clear the input field in the terminal. I'm working on a set of Red Hat servers where this suddenly stopped working. I tried canceling a grep
command using it (which worked before), all I get is ^C
printed as a separate line, and the grep keeps working. There are cases where ctrl
+ c
works, for instance stopping the top
command.
On my Ubuntu machine hitting ctrl
+ c
adds ^C
to the line, and then gives me a new and fresh line where I can type. On the RHEL servers, it does nothing.
I'm not sure where to start looking for an issue here, any pointers?
Output from stty -a
$ stty -a
speed 38400 baud; rows 23; 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 -cmspar 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
Update: Output from trap:
~$ trap
trap -- '' SIGINT
trap -- '' SIGQUIT
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU
stty -a | grep intr
, it should beintr = ^C
, it might got changed by a recent update. – Daniele Santi Jan 29 '19 at 15:45stty -a
? – Mark Plotnick Jan 29 '19 at 15:47trap - INT
to reset theSIGINT
handler to default if it was set to ignore. – Jan 29 '19 at 17:14trap
to see if the shell has been set to ignore SIGINT, as @UncleBilly said. – Mark Plotnick Jan 29 '19 at 17:27stty
will be misleading here. Your question needs to state what shell you are using. – JdeBP Jan 29 '19 at 20:50bash
, added the tag. – Tobb Jan 30 '19 at 10:26trap "" SIGINT
. See Which startup file is being used by my shell? to see if one of its init files has thattrap
line. – Mark Plotnick Jan 30 '19 at 17:27~/.bashrc
or~/.bash_profile
(or similar) file, or one of the/etc/*profile*
files. See if you can find it and see if it's accompanied by some comment. – Kusalananda Jul 29 '19 at 13:27trap
? – Tobb Jul 29 '19 at 13:48trap
command. – Kusalananda Jul 29 '19 at 15:40