DEV Community

Discussion on: 10 simple Linux tips which save 50% of my time in the command line

Collapse
 
5422m4n profile image
Sven Kanoldt

Whether you are in bash or zsh, you can use the ! operator quite flexible:

If we take: echo a b c d as an example

!$          # the last argument: d
!:*         # all the arguments: a b c d (can be shorten !*)
!:1         #  the first argument: a (same as !^)
!:1-3       # arguments from first to third: a b c
!:2-$       # arguments from the second to the last one: b c d