Shells like Bash or Zsh have one neat feature: repeat last command.

How to invoke it? Use double exclamation mark:

!!

This is very handy when you have typed the command as normal user, but it must be executed by sudo.

Example:

apt-get install safeq
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)

Execute the same command with elevated privileges:

sudo !!

No votes yet.
Please wait...

Post Navigation