Please Share!

Share

LinkedIn

Tweet

Pin 1 shares





Time and time again I find myself needing to run another command against the last item on the previous command line. To access that item in your current command, use “!$”.

When I’m done with a file, I delete it as in this example.

In this example, multiple commands are used to create and configure a user account. After the username is supplied the first time it is recalled on subsequent command lines by using “!$”.

[email protected]:~$ sudo useradd -m -s /bin/bash sally [email protected]:~$ sudo passwd !$ sudo passwd sally Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully [email protected]:~$ sudo chage -M 60 !$ sudo chage -M 60 sally [email protected]:~$ sudo chage -l !$ sudo chage -l sally Last password change : May 03, 2014 Password expires : Jul 02, 2014 Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 60 Number of days of warning before password expires : 14