How can I recall the argument of the previous bash command?

The Coder picture The Coder · Jul 30, 2010 · Viewed 96.1k times · Source

Is there a way in Bash to recall the argument of the previous command?

I usually do vi file.c followed by gcc file.c.

Is there a way in Bash to recall the argument of the previous command?

Answer

codaddict picture codaddict · Jul 30, 2010

You can use $_ or !$ to recall the last argument of the previous command.

Also Alt + . can be used to recall the last argument of any of the previous commands.