Tuesday, April 1, 2008

Bash: top keyboard shortcuts

There are people around me who've been Linux developers for years and they haven't taken a labor of reading "man bash" so far. It will not of course give you 1000% performance increase immediately but is worth reading it at least once. Just to support popular tradition, here is my list of most useful and frequently used keyboard shortcuts in bash(in order of popularity):

  1. Tab - autocomplete current command, directory or file name. I think it's about 50% of the whole statistics :)
  2. Ctrl-C - kill currently running something.
  3. Ctrl-R - search command history backward.
  4. Ctrl-L - the same as `clear` command. Wipe the screen. Very cool when you need to have blink console for the next info.
  5. Ctrl-A/Ctrl-E - go to the beginning/end of the current line. Sometimes Home/End keys are broken. Just in case.
  6. Ctrl-U/Ctrl-K - remove text from current position to the beginning or from current position to the end. Of course you can press <- or Delete key 200 times to get the same result..
  7. Ctrl-W - Remove the word(or part of it) before current position.
And this is something I've learnt recently:
  1. M-f/M-f - just forward/back one word
  2. Ctrl-v Tab - insert "Tab" char. Previously I did copy from Vim and paste :(
  3. M-u/M-l - change the current word to upper/lower case. Especially useful when Caps was pressed accidentally :)
  4. Ctrl-x @ - auto-complete hostname