I'm struggling with not working CTRL+C in a certain environment shell command line (CentOS 7 / Vagrant guest of Windows host). I use bash there. The OS, seem, does not matter.
Example run sleep 1000
and press the ctrl-c:
$ sleep 1000
^C^C^C
So, it's typing ^C and that's it.
^C
is bound for the interruption.
$ stty -a
intr = ^C; ...
How to make it work?
In the following post, where I was inspired to fix it, the answer explains a lot but does not give a simple answer on how to make it work.
Why didn't Ctrl-C work?
It seems it's a simple thing that I'm struggling with.
kill <PID>
you're trying to stop the program in an ordered manner. If you want to kill the program immediately you need to add -9 (the signal to stop a program immediately). You can test it pressing CTRL+Z, that will stop the process and get you back to the CLI prompt, you can then put the process in the backgroundbg <PID>
and then try to kill it, you will see you need the -9 or otherwise it will try to stop in an ordered manner and you will have to wait. – YoMismo Oct 10 '23 at 17:20