Reuse Arguments
Start course

This course covers a selection of more advanced command-line skills that you can use to become a more proficient Linux user. This course is part of the Linux Administration Bootcamp learning path, designed to get you up and running with Linux.

Learning Objectives

In this course, you will learn about the following features:

  • Tab completion
  • Repeat as root
  • Rerun a Command Starting with a String
  • Reuse Arguments
  • Strip Out Comments and Blank Lines
  • Reuse the Last Item from the Previous Command

Intended Audience

  • Anyone with intermediate knowledge of Linux who wants to learn more!


This is an advanced-level course so a good level of Linux knowledge is expected.



If you want to reuse all of the arguments from your previous command, and the current command use exclamation mark, asterisk or bang star. All the arguments from the previous command is everything on the command line except for the very first thing that appeared there. So typically, you'll have a command followed by one or more arguments. And bang star takes all those arguments from the previous command, and inserts them into your current command line. I find this helpful when I'm working on a series or a list of items like files or directories or that kind of thing. It's also helpful for correcting command typos. Sometimes, I mistype the word grep. I usually spell a GRPE for some reason so this saves me some typing as I can just retype the word grep and then follow that with bang star.

Let's look at a couple of examples here. I want to create three files. And if we want to look at those files with ls, so we can use this bang star. And then, we can even say, edit those files. This is file 1. This is file 2. This is file 3. And let's even just cat them all. And then, when we're done with the files, maybe want to move them somewhere so, bang star, tmp. And you can see that those ended up in tmp. So using exclamation mark star, really saved us a lot of typing in this simple example.

Here's another example. Let's just create three directories and then, let's change the permission on those directories. And then, if we look at that, we can see that, that happened and that saved us a little bit of typing. Let's do another example here. GRPE is not a command, so, let me correct that by typing GREP, and exclamation mark, dollar sign. We can use one of our other tricks since I didn't use sudu. I can use sudu, bang bang to get the entire previous line.

About the Author
Learning Paths

Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.

Covered Topics