Bash command line editing cheat sheet

Tim Abell · February 10, 2014

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: Tweet | LinkedIn
Suggest improvments: page source on github