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?

1 Answer 1


Don't know if this behaviour is implemented in bash but you could use backward search with ^R or history; !<number>. Those two commands saved a lot of time for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .