Linux command line

Bash Commands

Directory Operations

  • pwd Show current directory
  • mkdir Make directory
  • cd Change directory
  • cd .. Go up directory
  • ls List files

Bash Shortcuts

  • CTRL-c Stop current program
  • CTRL-z Sleep program
  • CTRL-a Go to start of line
  • CTRL-e Go to end of line
  • CTRL-u Cut from start of line
  • CTRL-k Cut to end of line
  • CTRL-r Search history
  • !! Repeat last command
  • !abc Run last command starting with abc
  • !abc:p Print last command starting with abc
  • !$ Last argument of previous command
  • ALT-. Last argument of previous command
  • !* All argument of previous command
  • ^abc^123 Run previous command replacing abc with 123

ls Options

  • -a show all (including hidden)
  • -R Recursive list
  • -r reverse order
  • -t sort by last modified
  • -S sort by file size
  • -l long listing format
  • -1 one file per line
  • -m comma separated outpout
  • -Q Quoted output