search_command_line_history_using_glob_pattern_matching
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
search_command_line_history_using_glob_pattern_matching [2022/05/05 12:52] – created admin | search_command_line_history_using_glob_pattern_matching [2022/05/05 13:09] – [Solution] admin | ||
---|---|---|---|
Line 5: | Line 5: | ||
When reverse searching the command line history using ctrl-r, a lot of characters have to be typed before arriving at the correct command. For example, to go to "cd ~/ | When reverse searching the command line history using ctrl-r, a lot of characters have to be typed before arriving at the correct command. For example, to go to "cd ~/ | ||
+ | <WRAP indent> | ||
< | < | ||
ctrl-r | ctrl-r | ||
cd< | cd< | ||
</ | </ | ||
+ | </ | ||
and keep hitting ctrl-r until arriving at | and keep hitting ctrl-r until arriving at | ||
+ | <WRAP indent> | ||
< | < | ||
cd ~/ | cd ~/ | ||
</ | </ | ||
+ | </ | ||
Another approach is to | Another approach is to | ||
+ | <WRAP indent> | ||
< | < | ||
ctrl-r | ctrl-r | ||
Line 20: | Line 25: | ||
< | < | ||
</ | </ | ||
+ | </ | ||
Here almost the entire command had to be typed since the user did many "cd ~/ | Here almost the entire command had to be typed since the user did many "cd ~/ | ||
Line 27: | Line 33: | ||
==== Solution ==== | ==== Solution ==== | ||
Add the following lines to ~/.zshrc. | Add the following lines to ~/.zshrc. | ||
+ | <WRAP indent> | ||
< | < | ||
# Use glob patterns when using ctrl-r | # Use glob patterns when using ctrl-r | ||
Line 38: | Line 45: | ||
fi | fi | ||
</ | </ | ||
+ | </ | ||
After this | After this | ||
+ | <WRAP indent> | ||
< | < | ||
ctrl-r | ctrl-r | ||
cd*rutils | cd*rutils | ||
</ | </ | ||
+ | </ | ||
will match commands where cd is followed by rutils. | will match commands where cd is followed by rutils. | ||
search_command_line_history_using_glob_pattern_matching.txt · Last modified: 2022/05/05 13:09 by admin