Consider that I've successfully run these two commands in this order (but perhaps many commands ago):
~% ssh localhost echo
~% sshfs localhost:/ /media/copy-of-root
Now I would like to rerun the ssh command. My first instinct is to use !ssh, but this will match the sshfs command instead.
Is there a version of history expansion which will match entire first words instead of prefixes of commands? If not, is there some other robust way to choose the ssh command over the sshfs one?
well, if you search for
ssh(with a trailing space) it will find it. IMO the best alternative is to bindupanddowntoup-line-or-searchanddown-line-or-search.Then you would just use:
% ssh [UP]
which would search for
sshin your history. If that is not the history instance you want, just keep searching (i.e. hitting "UP").