Miscellaneous:

  • Run script with verbose output: bash -v
  • Check for syntax errors: bash -n
  • Show xtrace info: bash -x
    • Lines which start with + are executed in the shell
    • Lines which start with ++ are executed in a sub-shell
  • Loop over alphabet with upper and lower case: for l in {{A..Z},{a..z}}; do echo $l ; done
  • Print text in beautiful columns by piping to: column -t
  • Echo a string to stderr: >&2 echo Hello, world.

Keyboard shortcuts:

If you’re using iTerm2, these may not work unless you follow these steps.

  • Delete backwards by word: CTRL+W
  • Delete forwards by word: ALT+D
  • Jump backwards by word: ALT+F
  • Jump forward by word: ALT+B
  • Undo last change: CTRL+-