4 ms·
alt-. or (ESC .) does something similar, but can be pressed repeatedly to keep going back further in history in case the argument you want isn't on the most rec
by sjs 15y ago
alt-. or (ESC .) does something similar, but can be pressed repeatedly to keep going back further in history in case the argument you want isn't on the most recent command.
!! is short for the previous command, but you can do !-2$ to get the last argument from the 2nd last command, or !cp$ to get the last argument from the most recent cp command. Or !cp:2 to get the 2nd argument to the most recent cp command. !# refers to the current command being entered (in zsh, don't know about bash).
Basically I second Aissen's recommendation to read up on history expansion. Super useful.