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.

RELATED: How to Use Your Bash History in the Linux or macOS Terminal

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 (reverse-i-search).

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.

RELATED: How to Clear the Terminal History on Linux or macOS

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.

Profile Photo for Justin Pot Justin Pot
Justin Pot has been writing about technology for over a decade, with work appearing in Digital Trends, The Next Web, Lifehacker, MakeUseOf, and the Zapier Blog. He also runs the Hillsboro Signal, a volunteer-driven local news outlet he founded.
Read Full Bio »