1. Home
  2. Training Library
  3. Linux Administration Bootcamp Introduction | CSL4 V2 A3.1 |

Reuse Arguments


Linux Administration Bootcamp
Installing and Connecting to a Linux System
Linux Boot Process and System Logging
Disk Management in Linux
User Management in Linux
Shell Scripting with Linux
Start course
7h 28m

In this course, you will learn how to install a Linux system and connect to it, whether that be on Mac or Windows.


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