RSS Feed

Using arguments from the previous command

Repeating arguments used in the previous command can be rather annoying, especially if it’s a long, complicated value. However, using an explanation mark can repeat the previous arguments. Much like using double explanation marks to repeat the entire previous command.

For example, if you were creating a directory structure, however, already thought you created a specific directory, the following would fail:

cd /path/to/newdir

One would create this directory with:

mkdir /path/to/newdir

Or, make life simpler for yourself:

mkdir !*

!* represents the first argument, !:2, the second and !$ the last.

Posted in Linux on the 9th September 2010


Your email address will not be published. Required fields are marked *