Everyone who regularly uses the command line has at least one long string they type regularly. Instead of entering all that again and again, quickly search your history to find the complete command.
Even if you know use your Bash history in the Linux or macOS Terminal, you might not know about the built-in search functionality, which lets you quickly find the latest command you typed using any series of characters. And it’s easy to use: just open your Terminal on macOS or Linux.
Now press Ctrl+R; you’ll see
Just start typing: the most recent command to include the characters you’ve typed will show up.
Include as much detail as necessary until the precise thing you’re looking for shows up. When it does, press Enter and the command will run instantly.
Yeah, I could have found a more useful example, but you get the idea: press Ctrl+R, type until you see a match, then press Enter.
Screenshots don’t get across how quickly this all works, so here’s a GIF of me pulling up a common command in just a few keystrokes:
Keep this keyboard shortcut handy if there are a few long-ish commands you type on a regular basis, because it’s a huge time saver.
Oh, and if you’re worried about someone else stumbling upon any embarrassing commands, you could clear your Terminal history. I won’t tell anyone.
- › How to Turn off a Chromebook Screen When Connected to an External Display
- › How to Use Your iPhone or iPad as an Apple TV Remote
- › How to Generate Two-Factor Authentication Codes in 1Password
- › 3 Ways to “Bookmark” a Folder in Finder on Mac
- › How to Automatically Back up Windows Folders to OneDrive