Recall previous CLI arguments with ease

Have you ever been running various commands on the same file or folder, and get sick of having to re-type it in each time? One easy way to get around this is with the built in recall arguments feature built into Linux. Essentially you hit (Alt + # + .) where (#) is the number of argument you are recalling:

Run a simple command with two arguments:

grep user1@domain1.com /var/log/exim_mainlog

Now after I type in the new command I want to run:

grep user2@domain2.com

I can recall the 2nd argument to grab my log path:

grep user2@domain2.com (Hold Alt + 2 + .)
grep user2@domain2.com /var/log/exim_mainlog

Leave a Reply

*

Page optimized by WP Minify WordPress Plugin