Car insurance

Archive

Archive for January, 2011

bash: reuse last argument from previous command

January 14th, 2011 1 comment

Reuse the last argument of the previous command with !$:

$ echo abc def
abc def
$ echo !$
def

A common use case would be mkdir and cd:

$ mkdir foo
$ cd !$

You can also insert the last argument of the previous command and continue typing with <ESC>.:

$ echo abc def
abc def
$ echo <ESC>. ghi
def ghi

Oh, the little things… :-)

Categories: English, Software Tags: