I know I can re-run a previous command using !!, but doing this in zshell only grabs the command and puts in on the new line, which requires me to press enter again to execute it.

For example:

~ echo test
~ !!
~ echo test

Bash does not seem to do that and it executes the command immediately. Can I achieve such behavior in zsh?

  • I set a simple example. Usually the use of this is to run sudo !!
    – EyfI
    Sep 12, 2018 at 17:35
  • under zsh -f the !! runs the previous command for me. have you altered the defaults anywhere?
    – thrig
    Sep 12, 2018 at 17:39
  • Not that I know of, I installed oh-my-zsh and some plugins. The answer suggesting unsetopt HIST_VERIFY helped though :)
    – EyfI
    Sep 12, 2018 at 17:45

1 Answer 1


You're looking for unsetopt HIST_VERIFY. Add that to your .zshrc is you want the change to be persistent. See man zshoptions.

  • Note that oh-my-zsh turns this back on, so set this after importing that (if you do so) in your RC file.
    – DopeGhoti
    Sep 17, 2018 at 22:48

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.