Why would typing Ctrl+c twice stop a running process in Linux

killsignals

There are Linux programs, for example vlc, that recommend typing ctrl+c twice to kill their execution from a terminal if the program didn't stop after the first one.

Why would typing ctrl+c twice work when the first time didn't work?

Best Answer

What it does is entirely application specific. When you press ctrl+c, the terminal emulator sends a SIGINT signal to the foreground application, which triggers the appropriate "signal handler". The default signal handler for SIGINT terminates the application. But any program can install its own signal handler for SIGINT (including a signal handler that does not stop the execution at all).

Apparently, vlc installs a signal handler that attempts to do some cleanup / graceful termination upon the first time it is invoked, and falls back to the default behavior of instantly terminating execution when it is invoked for a second time.