Skip to content

Linux Terminal

Get Help

  • man <command>: open man page for command
  • curl cheat.sh/<command>: get cheat.sh command examples
  • tldr <command> get tldr command examples

Useful Commands

  • hostnamectl: change hostname
  • sudo -i: login as root via sudo
  • timedatctl: check/set timezone
  • history: list shell history
  • compgen -c: list all available commands
  • compgen -a: list all aliases
  • compgen -k: list reserved shell keywords

Bash Tips

  • Open text editor to enter a command
  • Default mode (Emacs): C-x C-e
  • vi mode: Esc v
  • Use ! for history substitution: e.g. !3 to execute the 3rd command in the history
  • Use !! to execute the previous command
  • Use !cd to execute the most recent cd command. This also applies to any other commands

Keyboard Shortcuts (default Emacs)

  • C-c: to
  • C-a: jump to start of line
  • C-e: jump to end of line
  • C-u: delete to start of line
  • C-k: delete to end of line
  • C-l: clear screen