How can I use the bash history to run a command with the arguments from a command in the history?
I know that I can use
!! to rerun the last command, but how can I run a new command with those arguments?
eg, I first run:
I want to quickly run
!! anotherfile but it didn't work.
Or even better, how can I run
!-2 newarguments to run the second last history command with new arguments?
I don't want to use the arrows to scroll through the history then backspace over the arguments.