Using Ctrl-R
, I can search the history in bash.
But what to do, If I want to highlight the relevant word which has been typed upon by me.
Example:
(reverse-i-search)`mount': sudo mount /dev/sda2 /mnt
In the above reverse search, I want to highlight the world mount
from the entire command sudo mount /dev/sda2 /mnt
. How to achieve this in bash ?
Best Answer
readline
(whichbash
uses for its line editor) doesn't have that possibility.zsh
does it by default though. By default, it highlights the searched text with underlining, but you can change that. For instance with:Or:
(
zle
iszsh
's line editor, likereadline
isbash
's).