Sometimes, processes ignore the SIGINT signal sent by Ctrl-C in Bash. For instance,
vi. Assuming you don't want to google or read the manual on how to exit the running process, is there any key sequence that will always work (without leaving the terminal)?
Send the SIGQUIT signal with Ctrl+\.
→ This is equivalent to
There is also a set of Magic SysRq keyboard shortcuts. One of the more interesting ones is this: Alt+SysRq+k. It kills every process on the current virtual console. If one of your ttys is completely and utterly broken, this can be used to go back. On the tty running X.org, it can be used to kill X without mercy.
The SysRq key is, on most keyboards, the same as the Print Key. On my notebook, it can be invoked using the Fn key; I.e. Alt→Fn→Print→k in that order.
Here are some of the basic process management shortcuts:
Note: Ctrl+Z, in contrast to Ctrl+C and Ctrl+\, also works for man, vi, less, and the like.
When in doubt, the follwing procedure will almost always work:
^Z of course indicates that Ctrl+Z has been pressed.
For a more in-depth look at Shells and Terminals, also see my answers on:
|show 2 more comments|
Sometimes the CTRL+C is getting sent to the wrong program or input channel. This is especially common with editors such as
A simple, quick solution is to suspend the job CTRL+Z and then kill it by job number:
Where %1 is the number of job which was returned when you pressed Control-Z
If you are using ubuntu 10.04 you wanna enable this key to work.
To enable Control-Alt-Backspace
Select the Layouts tab and click on the Layout Options.
Select Key sequence to kill the X server and enable Control + Alt + Backspace.
Pressing Ctrl-Alt-Backspace will restart your X server.