5

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)?

3
  • stty doesn't say it should, it just print the word "kill". I can print "I'm sick", but it can't tell you wether I'm really sick or not. Commented Jan 11, 2019 at 0:53
  • Your confusion aside, I wonder what awful programs you have to run that much that you feel the need of a shortcut key for SIGKILL ;-) Anyways, try ^\ ; most programs don't bother to catch SIGQUIT.
    – user313992
    Commented Jan 11, 2019 at 1:32
  • The questioner already named one such program.
    – JdeBP
    Commented Jan 11, 2019 at 8:49

1 Answer 1

6

That kill is for character assassination, not death by signal. It should be documented in a the termios(4) man page,

Erase and kill processing occur when either of two special characters, the ERASE and KILL characters (see the Special Characters section), is received. This processing affects data in the input queue that has not yet been delimited by a newline NL, EOF, or EOL character. This undelimited data makes up the current line. The ERASE character deletes the last character in the current line, if there is any. The KILL character deletes all data in the current line, if there is any.

or termios(3) on linux

VKILL (025, NAK, Ctrl-U, or Ctrl-X, or also @) Kill character (KILL). This erases the input since the last EOF or beginning-of-line. Recognized when ICANON is set, and then not passed as input.

2
  • Or man stty: kill CHAR CHAR will erase the current line
    – tink
    Commented Jan 11, 2019 at 0:25
  • 1
    "character assassination" ROTFL
    – filbranden
    Commented Jan 11, 2019 at 0:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .