Trevor Hickey Trevor Hickey - 5 months ago 18
Bash Question

^U does not kill despite stty claims

problem: ctrl+U will not kill my terminal program.

details: Here are my results from
ssty --all

speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?;
swtch = M-^?; 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

As you can see, it describes the available signal interrupts:

^C = intr

^ \ = quit

^U = kill

etc ...

Here is an infinitely running program:

int main (){while(true){}}

ctrl+C works


ctrl+\ works

^\[1] 6331 quit (core dumped) ./main

ctrl+U does not work.

Why can't I kill a terminal program this way?

I could of course find the process id and run
kill -9 <PID>

but I want the shorthand to work.

I'm on Ubuntu:

lsb_release --all
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty

Here are my terminal specs, but I've tried other terminals (probably not relevant)

gnome-terminal --version
GNOME Terminal 3.6.2

It didn't work on xterm either. I've also tried different shells:

, ans

What could the problem be? Where should I look now?


kill in stty's output refers to the kill-line character, that is, pressing ^U erases to the beginning of the line.

The characters that send an interrupt signal are intr, quit, susp, and on some systems (not on Linux IIRC), dsusp.