20

In a zsh, maybe I pressed Alt+X by mistake, but now I'm stuck and this execute: _ prompt won't leave.

Pressing Ctrl+C does nothing.  If I press Enter it tries to complete what I typed.

Pressing Enter on an empty line:

execute: _
zsh: do you wish to see all 373 possibilities (64 lines)?

Typing q and pressing Enter:

execute: quote_
quoted-insert  quote-line     quote-region

In other shells, Alt+X brings the same behavior, except that Ctrl+C cancels the prompt.

Is there a way to get out or is this shell dead?

5
  • 1
    Are you sure you get the prompt for showing all possibilities on Ctrl+C? Usually this should close the "execute:" prompt. I only get this prompt on Enter (on an empty line) and Escape. As far as I can see from the manpage, this is also seems to be not configurable.
    – Adaephon
    May 25, 2016 at 23:45
  • I've got the same problem and I have an ominous feeling I have mapped the key to get out of this to something else Oct 3, 2017 at 14:38
  • @Sevenearths did you set any TRAP that you forgot to clear ? Your comment reminded me how I solved this bug (I think).
    – lolesque
    Oct 12, 2017 at 22:23
  • 1
    Does anyone know what this mode is called or how to actually use it?
    – ram
    Dec 13, 2020 at 21:22
  • 1
    It's called execute-named-cmd, triggered by in : in normal mode if you're using vim bindings.
    – hwong557
    Feb 2, 2021 at 22:14

3 Answers 3

20

Ctrl+G aborts the current editing command in Bash and Zsh if you are in Emacs mode (which is usually the default mode).

2
  • 1
    Thanks for the answer. Small note... Ctrl+g seems to work in vi mode too.
    – Lqueryvg
    Mar 7, 2020 at 16:07
  • thank you! while we are at it - sometimes (with vi mode enabled, dunno if related) I get stuck with a bad command which I can't cancel with Ctrl-C anymore, any quick ideas?
    – xeruf
    Oct 8, 2022 at 18:13
0

I succeeded by trying Ctrl+ everything, to see the behavior.

When I pressed Ctrl+S, the terminal emulator told me that output was blocked.  Then I pressed Ctrl+Q to enable output back, and my prompt came back to normal.

When I press Alt+X again, I have the same problem, but if I execute a zsh internal command it does it.

That's actually the current terminal / shell that doesn't receive Ctrl+C, I don't know why.

Edit from some time after (Oct 2017): It's probable that I had this bug due to a TRAP INT set up in my shell during some function and forgot to remove it.

-1
ctrl + c
is working for me, using
ctrl + g 
will print
^g
on my terminal
1
  • 1
    Are you willing to give your computer to lolesque (the OP)?  Because otherwise, telling what works on your computer isn’t any help to them, or to anybody else who has the same problem, inasmuch as the question says “Pressing Ctrl+C does nothing”. Nov 13, 2020 at 19:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .