Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes after I accidentally typing something in the terminal, e.g. after invoking a "tee" command I am unable to quit from that program to get back to the terminal. I usually try typing :q, quit, CTRL-Break, but nothing helps. So I close the terminal and open a new instance. Is there a standard way to quit from the executing command?

share|improve this question
Another option is Ctrl+\. Like Ctrl+C, programs can catch the signal generated by Ctrl+\ and keep running if they want to, but very few programs do so. – Scott Aug 15 '14 at 16:06
up vote 5 down vote accepted

You can Use Ctrl + C or can use Ctrl + Z key to terminate a running process in command line

share|improve this answer
Thank you. What is the difference b/w CTRL+C and CTRL+Z in that case? – Mitten Aug 10 '13 at 8:41
Ctrl+C sends a signal to the the program to exit, while Ctrl+Z suspends the program. The program in question can choose what to do when receiving the signal from Ctrl+C, whereas Ctrl+Z stops it right away. You should only use Ctrl+Z when Ctrl+C doesn't work (since Ctrl+C gives the program the chance to clean up temporary files and so on). – evilsoup Aug 10 '13 at 9:27
@evilsoup: As noted in a comment under the answer you linked to, Ctrl+Z also sends a signal (SIGTSTP) that is catchable (although very few programs do so). And, to clarify the above answer, if you type Ctrl+C and get a shell prompt back, you have terminated the running process. If you type Ctrl+Z and get a shell prompt back, you have only suspended the process – it’s still alive, just not running. – Scott Aug 15 '14 at 16:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.