Bash: How to Navigate Command History After Scrolling Up

bashcommand history

Apologies, this title is not the most elegant I've ever devised.

But I assume a lot of people will have wondered this, and my question may be a dupe… all I can say is I haven't found it.

When I say "scrolling" up, I mean using the "up arrow" key on the keyboard, which obviously scrolls you up through the history, starting at the most recent command.

So you find a command maybe 30 commands back… and you run it. And then you want to run the command which originally came after it… is there is a snappy way of doing this? Or how do those fluent in BASH do this?

Best Answer

Running the command with Ctrl+o instead of Enter will run a command from history and then queue up the next one instead of returning to the front of the bash history.

Related Question