Within the shell, typing ALT+.
or using !$
recalls the last passed argument of the previous command. I use this all the time, but how do you do that when you detached the previous command?
$ do-something foo a_long_file_name &
How do I get a_long_file_name
on the prompt, and not the ampersand?
Best Answer
\e-\e.
(or pressing-
and.
while holding alt/option) inserts the second last word.Similarly,
\e-2\e.
inserts the third last word, and\e2\e.
inserts the third word.