20

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.

1
  • Title improvements welcome; I do not know if "sh program" is the correct term. Nov 26 '12 at 7:46
27

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.

0
2

Try ctrl+d that should kill the shell.

0
0

If you shell exit is pre planned then use,

exit

Or you can program to handle SIGTERM and other signals a sample tutorial

Or if you want to stop already running shell script

ctrl+c
ctrl+d
ctrl+z

Or find the pid and kill it.

ps -ax | grep shell_name
pkill -9 PID_of_shell
2
  • OP specifically stated that Ctrl-c,Ctrl-z, Ctrl-x and exit did not work. Apr 7 '17 at 15:17
  • This doesn't work.
    – NelsonGon
    Jun 16 '19 at 12:51
0

Hold Ctrl and press p q. This solved my issue.

-1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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