Reputation:
How do we get into certain bash' line of command history by referring to its history line number, and then go normally up/down key to o next/previous history walking through ?
Upvotes: 0
Views: 57
Reputation: 531095
You can provide a numeric argument to the up key to specify how many commands to go up. Given a history like
...
100 echo 1
101 echo 2
102 echo 3
104 echo 4
up-arrow by itself gives you echo 4
. But (using default emacs
key bindings) you can specify type Alt-2 up-arrow (providing a numeric argument of 2 for the following command) to get echo 3
instead.
When you know the exact history number, use history expansion (!102
) instead of up-arrow to navigate to the desired command.
Upvotes: 1