1

Using the command yes you can make a loop in the Linux terminal.  How do you exit out of said loop?  (I tried Ctrl+C but it didn't work).

John D
  • 121
  • 1
  • 2
  • 6
  • ^ Yep can't reproduce. – Hunter.S.Thompson Nov 03 '17 at 15:23
  • 8
    Where and how did you start it? `^C` should have killed that `yes` command if you had started it by entering it at the prompt of an interactive shell in a terminal (with sane tty settings) – Stéphane Chazelas Nov 03 '17 at 15:24
  • It happened to me, invoking alpine Linux with: `docker run -i --rm alpine /bin/ash` then entering `yes`. The only way to stop it was to kill the process from another terminal session, getting the id with `ps aux | grep docker`. For the "Ctrl + C" to work, I had to invoke Linux with adding the t option: `docker run -ti --rm alpine /bin/ash` – Yoric Dec 28 '18 at 05:01

1 Answers1

3

stty -a should give you a list of key shortcuts for your terminal. In particular, you should see a line that looks something like this:

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; ...

Presumably, you will not have ^C listed next to intr =. Try whatever combo is there instead; if that doesn't work, you can try your quit or kill combos as well -- here, Ctrl + \ and Ctrl + U, respectively.