Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I run the following commands in bash:

mkdir foo
cd !$

The second command will be interpreted as cd foo and executed.

In zshell (at least with my current configuration), it will make the substitution, create the command cd foo, and leave my cursor at the end of it, so that I have to hit enter again to execute.

Is there a way to make it just execute the command?

share|improve this question
up vote 5 down vote accepted

From man zshoptions:


Whenever the user enters a line with history expansion, don't execute the line directly; instead, perform history expansion and reload the line into the editing buffer.

So just add setopt no_hist_verifyto your .zshrc

Edit: Remove accidental single quote that was breaking command

share|improve this answer
Thanks for the tip. Just a small correction: I had to use setopt no_histverify (without the second underscore) for it to work. This is with zsh 5.0.2. – zzamboni Apr 7 '14 at 16:22

You must log in to answer this question.

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