Search your shell history with Ctrl+R
Stop pressing the up arrow 40 times. Type any part of an old command and it appears.
- Press
Ctrl+R. - Type any part of the command you're looking for.
- Press
Ctrl+Ragain to step back to older matches. - Press
Enterto run it, or an arrow key to edit it first.Ctrl+Gcancels.
Tip: Works in bash and zsh by default.
Try it now: Open a terminal, press Ctrl+R and type "git" to find your last git command.
Next crumbs
- 💻 Terminal & gitJump back with cd -Toggle between your last two directories, like Alt+Tab for folders.
- 💻 Terminal & gitRerun the last command with sudo !!Got "permission denied"? Don't retype it.
!!means "the previous command." - 💻 Terminal & gitFix your last commit with --amendForgot a file or made a typo in the message? Fold the fix into the commit you just made.