Save Typing by Reusing All Arguments of the Previous Linux Command

You might want to reuse all of the arguments to a previous command in the shell if you realized you want to open the file with a different utility, but don’t feel like typing out the whole path again.

For instance, say you ran a cat on a file deep within a folder structure, like this:

cat /home/geek/documents/testfiles/testfile1

If you want to open that file up in vi, you don’t have to retype the whole command (or hit the up key and edit the command). Just type in the following:

vi !*

This would be expanded out to:

vi /home/geek/documents/testfiles/testfile1

Saves some typing, and just a useful command to know.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.