Bash keyboard shortcuts in iTerm like Alt+d and Alt+f

26,982

The Option key (the Mac name for the Alt key) by default has other uses. Press Command+O to open the list of profiles, select Default (I assume that is the profile you are using), and click "Edit Profiles...". In the resulting window, click on the "Keys" tab, and select "+Esc" for one or both option keys. This should cause iTerm to treat the Option key the way you are accustomed.

Alternatively, you can simply use the Escape key instead.

enter image description here

Share:
26,982
rewolf
Author by

rewolf

South African Living in Tokyo Software Engineer too Love snowboarding

Updated on February 12, 2022

Comments

  • rewolf
    rewolf over 2 years

    Everyone at work recommended iTerm2 to me instead of the native Terminal. But iTerm2 doesn't seem to allow me to use bash shortcuts like Alt+B and Alt+F to jump back/forward between tokens, or Alt+D to delete a word.

    I can't imagine this isn't available. Can anyone help me out?

  • rewolf
    rewolf almost 11 years
    Thanks this was the config I was looking for. I keep forgetting it's call "Option" as mine says "alt" above it, so I didn't even consider that setting when I skimmed offer the dialogs. I don't want to use Esc, as I'm switching between my mac and a linux box all the time which Esc doesn't work with. Thanks a lot. NOTE to reader. select "Esc+" not "Meta" for the "option" key override.
  • Damien Bezborodow
    Damien Bezborodow almost 9 years
    Be sure to navigate to "Preferences -> Profiles -> Default -> Keys" instead of "Preferences -> Keys".
  • switz
    switz about 5 years
    Well this is fantastic, thank you very much!
  • 6005
    6005 about 5 years
    Command O does not open profiles for me. Where do I find this on the latest mac?
  • 6005
    6005 about 5 years
    Also using esc-F doesn't work with multiple presses (you have to release and re-press esc each time, which is a bit annoying)
  • 6005
    6005 about 5 years
    Ah I found it -- Terminal > Preferences. (I thought this was a system wide thing so I was looking in system preferences.) I'm glad the remapping is only local to Terminal. See the comments here