15

I would like to be able to send the SIGTERM signal with a command line shortcut, like I can send SIGINT with Ctrl+C.

I ve read before about ctrl+d, but that does not work here, nothing happen.

I also read this SO SIGTERM with a keyboard shortcut.

$ stty -a
speed 38400 baud; rows 43; columns 123; 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 -extproc

Is quit the signal i want to trigger? Is kill the signal i want to trigger?

And very stupidly... How to input that '^\' or '^U' in my keyboard? I shall just type it then press enter?

3
  • 1
    ^U means Ctrl+U, I think. May 10, 2016 at 21:34
  • probably yes, but the behavior is so weird. I type ctrl+Y it prints ^Y on the console, then i type ctrl+U, it erase the line : /
    – mh-cbon
    May 10, 2016 at 21:37
  • See also: stackoverflow.com/q/6764265/1959808
    – 0 _
    Apr 8, 2018 at 2:42

2 Answers 2

9

No, SIGTERM cannot be sent from the command line, as noted at: https://superuser.com/a/343611/199930.

See also: https://unix.stackexchange.com/q/362559/43390

28

It's not entirely true that you can't send SIGTERM from the command line. You can't send it from a keyboard shortcut, but you can send it from the command line.

Based on the man-page for kill, you are able to send a SIGTERM to any process. You would accomplish this by finding your process in the process table (type ps) and then typing kill -15 [pid].

Here is a list of the keyboard shortcuts that you can use in a terminal to handle processes:

  • Ctrl+C sends SIGINT which asks to interrupt a program but can be caught or ignored.
  • Ctrl+Z sends SIGTSTP which asks to pause a program but can be caught or ignored. This process can be resumed later.
  • Ctrl+\ sends SIGQUIT which is the same as SIGINT except it also produces a core dump.

Source 1 and Source 2

3
  • 5
    Note that the default signal sent by kill is SIGTERM, so your kill command could just be kill [pid]. Apr 6, 2021 at 15:22
  • Ctrl+\ for SIGQUIT worked for me on OS X (an application was catching SIGINT), thank you! Apr 22, 2021 at 14:30
  • 7
    kill -15 <pid> or kill -s SIGTERM <pid>
    – Eric
    Oct 2, 2021 at 1:58

You must log in to answer this question.

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