Ctrl+C does not quit a running program in terminal

Solution 1:

Note: Answer andded after comments...

I'm pretty sure it will kill most terminal programs; of course, it won't kill the ones that fork a new process, then return the prompt immediately.

Some programs may catch this interrupt and handle it however they want, or even ignore it. It may depend a lot on whether the program is designed to be run in a terminal or from a GUI.

A few of the programs I just tried in 10.04 and 11.10 that will end are:

ping - which runs continuously by default, so this is the only way to stop it;
find - often takes a long time, so it's useful to be able to end it.
gedit

Solution 2:

Actually, many programs will not stop on Ctrl+C because all it does is create an exception in currently running thread. Multithread programs as well as programs with "In case of any exception, go on forward." sort of instructions will continue. The proper case of actions will be either one of:

  1. Use Ctrl + Break key combo.
  2. Press Ctrl + Z. This will not stop program but will return you the command prompt. Then, do ps -ax | grep *%program_name%*. Find the line corresponding to the one yopu want to stop. The first integer in line will be program ID. Do kill -9 %id% to finally stop it.
  3. If program also eats a lot of resources, you can use top command in a separate terminal to see the ID faster.

Solution 3:

I have faced this problem with one of my user having 10.04. The same issue has been discussed here CTRL+C no longer works in terminal

You can however terminate command using CTRL+SHIFT+C

It seems like copy-to-clipboard and terminate commands switched their keyboard shortcuts.