Skip to content

Instantly share code, notes, and snippets.

@gomes-work
Created August 17, 2018 00:51
Show Gist options
  • Save gomes-work/d5aec86a5e4559529c87ccdaa4dd0836 to your computer and use it in GitHub Desktop.
Save gomes-work/d5aec86a5e4559529c87ccdaa4dd0836 to your computer and use it in GitHub Desktop.
!! # will expand to last command in history
!<n> # will expand to history command number 'n' (could be negative meaning most recent n)
!<word> # last comand in history starting with 'ssh'
!-1 # will expand to last command in history
^word^new # replace 'word' by 'new' in the last command in history
!!:s/word/new # same as above
!!:gs/word/new # global substitution
!:<n> # will expand to 'n'th word in the last command
!:^ and !:$ # will expand to first and last arguments
## Modifiers ##
cat /usr/share/doc/manpages/copyright/test.txt
!$:h -> /usr/share/doc/manpages/copyright
!$:e -> txt
!$:t -> test.txt
!$:t:u -> TEST.TXT
!$:t:q -> 'test.txt'
ls -l 'application.clj'
!$:Q -> application.clj
this is a test 1 2 3
!*:x -> 'is' 'a' 'test' '1' '2' '3'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment