Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I bungled the commands and wrote sh -man

Now I've entered a program called sh-3.2 that is seemingly impossible to exit.

Ctrlc,Ctrlz, or Ctrlxdoes not work.

exit, quit, q, :q also does not work.

All google answers are for exiting shell scripts programmatically.

share|improve this question
Title improvements welcome; I do not know if "sh program" is the correct term. – The Unfun Cat Nov 26 '12 at 7:46
Ctrl+D does the trick for me. – jippie Nov 26 '12 at 7:50
Post as answer so this thread can get an accepted answer. Will probably be useful to some other newb in the future. – The Unfun Cat Nov 26 '12 at 7:51
up vote 10 down vote accepted

Ctrl+D does the trick for me.

Actually it is the -n flag that introduces this behaviour. It is meant to do only syntax checking of the commands, but doesn't actually execute them.

share|improve this answer

Try ctrl+d that should kill the shell.

share|improve this answer

If you can paste the "bungled" shell script here, we can all see and comment on how to properly exit from it. Unless you executed a "trap" statement and prevented ctrl-c from functioning as expected, ctrl-c should break the execution of the script at any given moment.

Please post your code for a better answer

share|improve this answer
A bit quick there- it is one the first line: "sh -man" ;) – The Unfun Cat Nov 29 '12 at 18:57

Try logout or Ctrl+d. They are the same.

share|improve this answer

Try also typing ` which is in the same key as ~ on the keyboard, and then press Return. Ctrl+D kills the terminal but ` won't.

share|improve this answer
Typing what !? Remember that around the world different keys are in different places, so whatever is on your ~ key almost certainly won't reliably match someone else's. – roaima Nov 6 '15 at 17:51
@roaima they meant a backtick but the markup ate it. – terdon Nov 6 '15 at 18:08

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.