Wednesday, 7 August 2013

Making bash command history act like Windows command shell

Making bash command history act like Windows command shell

In bash, up arrow recalls the previous command. Tap it twenty times, I get
the command from twenty places back in history which I ran five minutes
ago. Suppose I run that command right now. Now when I tap up arrow, I
recall the most recent command - that one I just re-ran, and additional
taps take me back through the history just like before.
Perhaps five minutes ago, I had run four commands in series that I want to
run again. I must tap up arrow twenty time again, and again, and again.
In Microsoft Windows, in their command shell, I can recall a command from
a while ago, re-run it, and then when I tap up arrow, I get the command
from before that, from five minutes ago. I can get the commands following
that one from five minutes ago, with less effort and less wearing out of
the arrow keys.
So, bash (and i guess most unix/linux shells) always starts its history
recall from the most recent command, while Windows will remember a
long-ago command's place and recall relative to that.
Is it possible to recall history in bash in the way that Windows does it?

No comments:

Post a Comment