substitution on a history command with :s/old/new/ • This will only replace the first occurrence, to replace all, use :gs/old/new/ • We can use ^old^new as a shorthand for !!:s/old/new/
last !r Last command beginning with r !!:s/in/out/ Last command with the first in replaced by out !!:gs/in/out/ Last command with all in replaced by out !$ The final argument to the last command !* All arguments to the last command