Skip to content

Instantly share code, notes, and snippets.

@Sam-Gram
Last active March 28, 2019 20:57
Show Gist options
  • Save Sam-Gram/d546875d73af2d32ca043bd7379063f3 to your computer and use it in GitHub Desktop.
Save Sam-Gram/d546875d73af2d32ca043bd7379063f3 to your computer and use it in GitHub Desktop.
Bash exclamation point expansions
ShortcutExplanation
!!Last command
!:nLast command’s nth argument
!*Last command’s arguments
!$Last command’s last argument
!:m-nLast command’s mth through nth arguments
!:n-Last command’s nth through second-to-last arguments
!:n-$Last command’s nth through last arguments
!:n*Last command’s nth through last arguments
!nThe nth command in the history
!-nThe command n commands ago
!-n:mThe command n commands ago’s mth argument
!-2:2The command two commands ago’s second argument
!-2:0The command two commands ago without arguments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment