How to selectively navigate through Bash command history on a Linux terminal [duplicate]
Solution 1:
You can search the history using Ctrl+R and then type the search string (e.g. iw
to find iwconfig
). Then you can then still navigate through the history at that point with the up and down arrow keys, or press Ctrl+R again to find the previous occurence.
Solution 2:
After a bit of practice, I found how to use the workaround solution.
I matched the correct syntax to print a filtered list, I did it with history | grep iwconfig
(it wasn't so difficult after all); with the output I can use !n
with the now easy-to-read filtered list.
Solution 3:
I can't comment on Stefan's answer, but you normally have to keep pressing Ctrl+R. See this page for more information.