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?
1 Answer
You can Use Ctrl + C or can use Ctrl + Z key to terminate a running process in command line
-
-
4Ctrl+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).– evilsoupAug 10, 2013 at 9:27
-
1@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. Aug 15, 2014 at 16:07