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 bindup
anddown
toup-line-or-search
anddown-line-or-search
.Then you would just use:
% ssh [UP]
which would search for
ssh
in your history. If that is not the history instance you want, just keep searching (i.e. hitting "UP").