Bash command line editing cheat sheet

February 10, 2014

0 minute read

https://www.gnu.org/software/bash/manual/bashref.html#Readline-Interaction

  • ctrl-a/e start/end of line
  • alt-f/b forward/back a word
  • ctrl-w/alt-d delete to start/end of word
  • alt-. add argument from previous command (repeat to cycle) - love this one
  • ctrl-shift-_ undo (i.e. ctrl-underscore)
  • ctrl-y paste (yank) deleted text

    • alt-y paste older deleted text instead
  • prefix with alt+digit (0-9) to do multiple, e.g. delete two words

  • start with alt-minus to go backwards

Just a few notes I threw together for my own benefit. I finally got around to learning a bit more about editing commands on the Linux shell / terminal.

Photo of flooded River Thames at Henley, half-submerging the benches of the Angel pub

Share as Tweet || Share on LinkedIn
Post source code on GitHub - suggestions & PRs welcome!
Subscribe for updates on software development, contracting, side projects, blog posts and who knows what else. Read the archives for an idea of content.

Mailing list powered by the excellent buttondown.email.