HSTR (HiSToRy) – Advanced console history search - Kote

HSTR (HiSToRy) – Advanced console history search

HSTR or HH is a great tool that speeds up console usage due to the intelligent search for recent and favorite commands. Before that, I used to have a few hacks like running grep for history ($ history | grep {my-search-request}), but with a new HH help, I feel like I can focus on tasks and not worry about recent commands entered as they can be accessed fast and convenient.

Here is the description from the official GitHub page

Are you looking for a command that you used recently? Do you want to avoid the need to write long commands over and over again? Are you looking for a tool that is able to manage your favorite commands?

HSTR (HiSToRy) is a command line utility that brings improved bash/zsh command completion from the history. It aims to make completion easier and more efficient than Ctrl-r.

HSTR can also manage your command history (for instance you can remove commands that are obsolete or contain a piece of sensitive information) or bookmark your favorite commands.

After the installation, the only essential thing is to bind HSTR to “Ctrl+r” shortcut

$ bind '"\C-r": "\C-a hstr -- \C-j"'

After that “Ctrl+r” will run the History menu where you can filter recent commands by typing them or using cursor keys to select from the filtered list.

In addition, the History list may be adjusted so you can list your favorite commands at the top.

There is no more need for endless looping with cursor keys or jiggling commands from other files. All entered commands are at your fingertips with HSTR.