Run the previous command without typing the previous command in the shell
Today I discovered that you can run the previous command without typing the whole command again. For example if you had to type a long command, in my case it was a docker command.
Something like this -
docker run -p 8080:80 -d --name {conatiner-name} {image-name}
But, I needed a sudo
, so instead of typing
sudo docker run -p 8080:80 -d --name {conatiner-name} {image-name}
we can do this
sudo !!
the !!
will recall the last entered command in the shell and execute.