Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.