How-To Geek
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.
Got Feedback? Join the discussion at discuss.howtogeek.com
Programmer by day, geek by night, The Geek, also known as Lowell Heddings, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.
- Published 07/28/10



