obda.net

Zsh History Expansion

Add a comment

cheat-sheet articles are about code snippets that I need every once in a while, and which I constantly forget about.

Shortcut Description
!! the entire previous command
!!^ the first argument from the previous command
!!* all arguments from the previous command
!!:n the n-th word from the previous command
!!$ the last word from the previous command
!# the entire current command line (typed in so far)
!#^ the first argument from the current command line
!#* all arguments from the current command line
!#:n the n-th word from the current command line
!#$ the last word from the current command line

For more information, read Andrew Grangaard’s Zsh history expansion article.