History expansions let you interact with bash's history. For example, if you forgot to run a command with sudo
, you can sudo !!
to rerun the last command with it. !$
can be used to access the last argument of the last command.
There is an error in the transcription. It says:
[...] If I do
!! sudo
, you can see it runs it again. Now it works.
Should be:
[...] If I do
sudo !!
, you can see it runs it again. Now it works