Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

yank-last-arg / insert-last-argument is probably better known by its usual shortcut, Alt-.. It's very nice to navigate through the last argument of earlier commands, but if you're navigating a little too fast it's easy to miss the argument you wanted, and then it seems you have no other choice but to start all over again. This slows down the navigation, so I hope there's a command to navigate this list in reverse.

A quick look at bind -P didn't show any obvious candidates for this purpose.

share|improve this question
up vote 7 down vote accepted

If you type Alt-- 1, then Alt-. the direction is reversed. Typing it again revert back to the usual direction.

Some explanations are in bash's man page:

       yank-last-arg (M-., M-_)
              Insert  the last argument to the previous command (the last word
              of the previous history entry).  With a numeric argument, behave
              exactly  like  yank-nth-arg.   Successive calls to yank-last-arg
              move back through the history list, inserting the last word  (or
              the  word  specified  by the argument to the first call) of each
              line in turn.  Any numeric argument supplied to these successive
              calls  determines  the direction to move through the history.  A
              negative argument switches the  direction  through  the  history
              (back or forward).  The history expansion facilities are used to
              extract the last argument, as if the "!$" history expansion  had
              been specified.
share|improve this answer
Alt+- Alt+. is easier to type and equivalent. But this isn't quite Alt+. in reverse: Alt+- Alt+. Alt+- Alt+. does not undo Alt+. Alt+., it toggles between the last two values. – Gilles Apr 30 '12 at 23:41

Your Answer


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.