I know about Alt + . to show the previous argument in bash.
But what if I went past the desired argument (pressing Alt + . one too many times) and I want to go forward in history?
Is there a key combination for that?
bashkeyboard shortcutsreadline
I know about Alt + . to show the previous argument in bash.
But what if I went past the desired argument (pressing Alt + . one too many times) and I want to go forward in history?
Is there a key combination for that?
Best Answer
The Alt-. runs readline function
yank-last-arg
:So to reverse its meaning one has to supply a negative argument to it. This can be done via other functions:
digit-argument
oruniversal-argument
. The first is easier to use because it is already bound to Alt-[[:digit:]] and Alt-- for negative arguments.So, to go backward in history run Alt-.. To go forward run Alt-- Alt-. and repeat with just Alt-.. To go backward again, switch directions again with Alt-- Alt-..