Brandon Cardoso

Shell

Notes seedling created edit

Useful shortcuts

  • CtrlU - Cut text from cursor to beginning of line.
  • CtrlK - Cut text from cursor to end of line.
  • CtrlA - Jump to beginning of line.
  • CtrlE - Jump to end of line.
  • CtrlX then CtrlE - Opens current command in $EDITOR. Executes on save and exit. (related: fc)
  • Alt. or Esc. - Insert the last argument from previous command. Repeated use goes further in history.

Useful commands

  • cd - - Change to the previous directory.
  • > file.txt - Completely empty file without deleting or recreating. Preserves file permissions, ownership, and doesn’t interrupt processes that have the file open already.
  • $_ - Expands to the last argument of the previous command. mkdir -p /some/long/path/newdir && cd $_
  • fc - Opens previous command in $EDITOR. Re-executes on save and exit.