More on bash history
shell | n0str0m0 | (2)
Bash provides a powerful history system that helps you in repeating commands and arguments.
For example, the !! command, repeats the last executed command.
If you want to execute a command typed before the last one, you can select it with the following:
!-number
Something like this:
$ ls
$ ps
$ !-2
The last command executes ls again.
In addition, you can specify previous arguments too. This is done with the !:n command (n being a number). Let's see an example:
$ less file.txt
$ cp !:1 file_copy.txt
The last command takes the first argument of the previous executed command and makes a copy with a different name.
If this is not ...