Macos – way to jump to an earlier part of a command line command in the Mac Terminal

bashmacmacosterminal

I'll often find myself writing out long commands in the bash shell – things with many arguments, web addresses, routes, etc and so on. Every so often I will realize I forgot to, say, put my "bundle exec" at the beginning of the command, or misspelled something, or forgot quotes. Or something as simply as putting "cd" instead of "vim".

Thus begins the tedious process of holding the left arrow key until I get back to the beginning of the command.

Is there an any way to jump to the beginning of the line again?

Best Answer

In addition to ^A and ^E, you can do

  • Esc-b to jump back one word
  • Esc-f to jump forward one word
  • Ctrl-b to move back one character
  • Ctrl-f to move forward one character

See the bash manual for commands for moving.

Related Question