Bash shell shortcuts

I have been irritated not having standard keyboard shortcuts, like Ctrl-arrow left (move word left) and Ctrl-arrow right (move word right), available on the bash command line. It turns out they are. If you know what the meta key is. Meta key? Yes, I didn’t know which key this was either.

It turns out that it is the Alt key. This is because historically, many Unix workstations had a key labeled Meta where PCs have a key labeled Alt.

So here is a little bash command line cheat sheet.

  • Ctrl-a: Move to the start of the current line.
  • Ctrl-e: Move to the end of the line.
  • Ctrl-f: Move forward a character.
  • Ctrl-b: Move back a character.
  • Meta-f: Move forward to the end of the next word. Words are composed of letters and digits.
  • Meta-b: Move backward to the start of the next word. Words are composed of letters and digits.

Have fun.

Leave a comment