How to bind a key to sigkill in bash?

Daniel Lucraft picture Daniel Lucraft · Dec 4, 2008 · Viewed 10.4k times · Source

I'm developing my application (on Linux) and sadly it sometimes hangs. I can use Ctrl+C to send sigint, but my program is ignoring sigint because it's too far gone. So I have to do the process-killing-dance:

Ctrl+Z
$ ps aux | grep process_name
$ kill -9 pid

Is there a way to configure bash to send the kill signal to the current process when I press - say - Ctrl+Shift+C?

Answer

camh picture camh · Dec 4, 2008

I don't think there is any key you can use to send a SIGKILL.

Will SIGQUIT do instead? If you are not catching that, the default is to core dump the process. By default this is ^\. You can see this by running:

$ stty -a

in a terminal. It should say:

quit = ^\