How to access to the previously typed command in bash terminal

Often you forget that you need root privileges while typing some commands in bash terminal.

For instance, you typed:

dnf update which needs sudo privileges and you’re obliged to type sudo dnf update.

Instead of retyping dnf update, you can type only sudo !! and !! will be replaced with the previously typed command.

Slavisa Jovanovic
Slavisa Jovanovic
Associate Professor (Maitre de conférence HDR)

My research interests include circuits and systems for AI and energy harvesting circuits.