I know that inside a terminal, Ctrl+C keyboard shortcut will send a SIGINT signal to the current foreground process.
Your knowledge is incorrect on two points:
- The signal is sent to the foreground process group.
- It's only CTRL+C if that is the special character that happens to be configured at the time. (That's the default on most modern systems, but historically it could have been the
DEL
character or something else.)
Is there a way to setup a keyboard shortcut for sending SIGTERM or even SIGKILL to the current process?
No. The line discipline controls what signals are sent, and those signals are hardwired. They are (in a standard Unix) SIGHUP
, SIGINT
, SIGTTOU
, SIGTTIN
, SIGQUIT
, and SIGTSTP
. There are no others generated by the line discipline.