send SIGTERM with command line shortcut
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?
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
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 asSIGINT
except it also produces a core dump.
Source 1 and Source 2