I can interrupt a program by pressing ctrl+c
in the shell. Often this kills the program but some programs trap the signal and keep running.
I want to be able to kill such programs more aggressively and did some research. I read that stty -a
will list tty shortcuts. Here is the output:
speed 38400 baud; rows 27; columns 213; 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; discard = ^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 -flusho -extproc
Let me draw your attention to
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; [...]
Two of those look familiar: ^C
and ^D
, and it looks like ^U
should send sigkill, which I believe should be like kill -9
.
In my particular case, I want to kill ddd, which is otherwise difficult to close sometimes. If I crtl+u
from the shell, it has no effect, although kill -9
on its PID will kill it.
Am I wrong in interpreting this output from stty -a
? Should ctrl+u
send SIGKILL? Why didn't this work as expected? Or, how can I conveniently send SIGKILL from the shell (i.e. the shell which ddd was launched from)?
Best Answer
That kill is for character assassination, not death by signal. It should be documented in a the
termios(4)
man page,or
termios(3)
on linux