Possible Duplicate:
How can I move around the bash commandline efficiently?

In the Windows prompt, one can go back or forward one word by pressing ctrl and <-/->. What's the equivalent in a bash environment?


There is M-b and M-f for moving backwards and forwards to the current word, respectively. Here M is the Meta or Esc key or a combination, like Ctrl+Meta. The section Commands for Moving in the bash manpage lists these and other shortcuts available for moving on the bash shell.

The manual also describes how to customize your bash settings so you can use your known Ctrl + / to skip words.

| improve this answer | |
  • I tried Esc+b/f,not working . – user11671 Mar 3 '10 at 7:09
  • 6
    Try the Alt key as well. The meta key is also emulated with the alt or windows key on keyboards that have them. – ayaz Mar 3 '10 at 8:12
  • @user11671: Does bind -p|grep forward-word produce "\ef": forward-word (among other things)? – Paused until further notice. Mar 3 '10 at 10:28
  • 3
    To directly answer the user's question, this works for me in ~/.inputrc in Ubuntu: # Assign Ctrl-right-arrow and Ctrl-left-arrow move to next/previous word "\e[1;5C": forward-word "\e\e[C": forward-word "\e[1;5D": backward-word "\e\e[D": backward-word source: bbs.archlinux.org/viewtopic.php?id=35154 – dougkramer Oct 20 '14 at 22:13
  • 1
    @dougkramer how does that directly answer users question? that's about rebinding the command, whereas user is asking what is the default equivalent – eis Mar 28 '18 at 8:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.