Readline And Shell Tricks

A collection of my favourite tricks:

  • sudo !! - re-run previous command with ‘sudo’ prepended
  • ctrl-k, ctrl-u, ctrl-w, ctrl-y - cutting and pasting text in the command line
  • alt+backspace - similar to ctrl-w but stops at special characters (ctrl-w stops at spaces)
  • ctrl left/right - jump word left/right
  • use ‘less +F’ to view logfiles, instead of ‘tail’ (ctrl-c, shift-f, q to quit)
  • ctrl-x-e - continue editing your current shell line in a text editor (uses $EDITOR)
  • fc - similar but edit/run previous command, see arguments to specify multiple commands
  • alt-. - paste previous command’s argument (useful for running multiple commands on the same resource)
  • reset - resets/unborks your terminal
  • ctrl-l - clear screen
  • inline expansion - {a..z}{a..z} or {a,b,c}{d,e,f}
  • ctrl-v TAB - insert a TAB character, works with other characters, too
comments powered by Disqus