History Lesson
Other Ways to Search
The history file can also be used in other ways. For example, you can pipe history
through the grep
command, searching for a string with history | grep SEARCH
(Figure 4). Another use of the history file is sometimes called a reverse -i
search. To use this function, press Ctrl+R and begin entering letters. As in tab completion, each letter entered narrows down the match. When you find the command you want, press Enter to activate it (Figure 5).
As this overview shows, the history
command has a greater ability to search than many users realize. It will take practice to find what features fit into your work habits, but learning the ones that work best for you will add just enough sophistication to make working at the command line easier – especially when you have the environmental variables set up to your satisfaction.
Infos
- Bash history man page: https://ss64.com/bash/history.html
« Previous 1 2
Buy this article as PDF
(incl. VAT)