Neat tips! thanks
We all know !! but it's mostly just used to sudo !!
I find !$ (which is last argument of the last command) incredibly useful:
#make a directory and go to it
# OR even better
# move then edit a file
mv ~/somefile.txt ~/renamed.txt
# edited a file, now add it to git
git add !$
There's a whole slew of ! commands but !$ is one I use all the time.
You can also use esc + . instead of !$. I find more natural and useful if you need to fix a typo.
Even better! Thanks
P.S. For posterity, all of these work just as well in zsh.
Funny $_ is the exact same as !$. There's always more to learn 😀.
We’re a place for programmers to stay up-to-date, learn new skills, and share ideas.
We’ll never post without your permission.