# History Tricks: !!, !$ and Ctrl+R

!! runs the last command again and !$ reuses its last argument, sudo !! repeats a command that needed sudo, Ctrl+R steps back through older matches, and four lines in ~/.bashrc keep a longer history that every terminal adds to.

![Cheat sheet for the lesson History Tricks: !!, !$ and Ctrl+R: !! runs the last command again and !$ reuses its last argument, sudo !! repeats a command that needed sudo, Ctrl+R steps back through older matches, and four lines in ~/.bashrc keep a longer history that every terminal adds to.](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/8b32844709ec47a9828bbe2d2f7fc4ca.webp)

- Category: Bash
- Level: Journeyman
- Tags: bashrc-and-profile, command-history, history-expansion, linux, sudo, unix
- Updated: November 10, 2026

Source: https://www.ask-codey.com/cheat-sheets/bash-history-tricks-cheat-sheet
