I am on a MAC, and I am trying to figure out shortcuts for my ZSH running on Iterm2.

When I type bindkey in the shell, I see (among other mappings), the following:

"^[b" backward-word
"^[f" forward-word

I know ^ is Control key. But what if I press Ctrl + [ + f, it does not go a word forward.

What am I missing?

  • Odd; Ctrl+[ works for me in iTerm2.
    – chepner
    Oct 28, 2014 at 22:03

4 Answers 4


^ is usually control, but ^[ actually means Escape or Alt (or meta, if you like emacs).

So you can press Escb or Escf for those key combinations.

By default, Alt doesn't work on Mac terminals, but iTerm2 has a setting: "Option acts as [ ] Normal [ ] Meta [ ] +Esc". You want +Esc.

Screenshot of iTerm2 Option key settings.


Actually ^[ is the Alt key. So in your case the terminal (Iterm2) uses Alt + b and Alt + f to go backwards and forwards a word. This is controled by your terminal and has nothing to do with zsh.

  • On a Mac, terminal emulators typically use the Escape key instead of Alt (Option), since the Option key has long been used for typing non-ASCII characters. (And in fact, ^[ is the ASCII representation for ASCII ESC.)
    – chepner
    Oct 28, 2014 at 22:02

To extend mrb answer:

Indeed ^[b is ESC+b or (Meta/Alt+b). You can display character literally by proceeding it with Ctrl+v. In this case you will find the following:

  • Ctrl+v Ctrl+b


  • Ctrl+v Meta+b


  • Ctrl+v ESC b


Additionally you will find in zsh manual:

backward-word (ESC-B ESC-b) (unbound) (unbound)
    Move to the beginning of the previous word.

and similarly for forward-word:

forward-word (ESC-F ESC-f) (unbound) (unbound)
              Move to the beginning of the next word.

The ^ notation is commonly used in the GNU world for control characters, where ^a is Ctrl-A (ASCII 1 where A is ASCII 65). In other words it is shorthand for "use the character 64 slots before this on".

The ESC key is ASCII 27 which is 64 steps before [, hence ^[ is shorthand for ESC.

In the GNU Emacs editor several modifier keys were used, CTRL, META and others. For instance CTRL-f moves the cursor a character forward and META-f moves the cursor a word forward.

In order to accomodate the many keyboards without a META key, a convention of "ESC means that the next character is to be considered pressed with the META-key". Therefore in GNU Emacs, pressing ESC-f moves the cursor a word forward.

Note that these days it is very rare that Ctrl-[ gives an ESC character, but it may be lurking in some other Ctrl-combination. For instance is ^^ still used in telnet sessions to escape to command mode, so it is useful to be able to find it.

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.