Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

4 Answers 4

up vote 5 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

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.