How to Reverse Search in Linux

Bash, the default Linux command-line shell, stores a history of commands you've typed into it recently. You can use the up arrow key at the console to cycle through the previous commands. However, a more efficient way to locate a command you recently used is to use Bash's reverse search feature. The reverse search feature performs a search for a command containing text you specify, starting at the end of the history--the most recently typed commands. A reverse search is different from a forward search, which searches from the start of the history--the least recently typed commands.

Instructions

    • 1

      Open a terminal if you're not already at one by clicking "Applications," "Accessories" and "Terminal."

    • 2

      Press "Ctrl" and "R" at the same time.

    • 3

      Type some text to search for at the "reverse-i-search" prompt. Bash automatically searches and provides the most recent matching result as you type.

    • 4

      Press "Ctrl" and "R" at the same time to cycle through commands matching the search query until you find the one you're looking for.

    • 5

      Run the command you searched for, if desired, by pressing "Enter."

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured