When we write commands especially long ones, we sometimes need to make edits. For example imagine:

docker run --rm --name My_container_3.19.2.9-999_khbdabshs --entrypoint bash registry.me.com:2001/apps/My_container_3.19.2.9-999_khbdabshs

Starting at the beginning of the line by hitting ctrl+a or end of line by hitting ctrl+e, how can I quickly get to the word bash?

Is there a shortcut to jump between docker run --rm --name My_container_3.19.2.9-999_khbdabshs --entrypoint bash registry.me.com:2001/apps/My_container_3.19.2.9-999_khbdabshs, which are all seperated by spaces?

I've seen people mention ctrl+b/f or esc+b/f but it doesn't exactly do what I want.

I'm using iTerm with ZSH on a macOS. Hopefully the shortcut works irrespective to what emulator or shell I use.


1 Answer 1


Meta-F will jump one "word" Forward.

Meta-B will jump one "word" Backward.

On many modern keyboards, Alt works as Meta. On a Mac, it may be Option You can also use Esc,F and Esc,B. For the latter iterations, it is not a key combination, but a key sequence: Press and release Esc, and then press and release either F or B.

You can also use Ctrl-] followed by any character to jump the cursor rightward to the next match for the specified character. So if your cursor is at the start of the line, Ctrl-],B three times would place the cursor at the b in bash.

Meta-Ctrl-] followed by any character to jump the cursor leftward similarly.

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.