bhCLI tool

Half-remember it, and still get it back.

bh searches ~/.bash_history fuzzily and floats what you actually use to the top — a terminal tool you can bind over Ctrl-R.

The bh search screen, with the typed characters highlighted across the candidates

Do any of these happen when you go looking for a command you typed before?

Ctrl-R only matches text laid out exactly as you typed it, so half-remembering gets you nothing
You hammer Ctrl-R backwards through the history and lose track of whether you have already passed it
Typos and one-off commands are mixed in, burying the ones you actually use
Clearing out a command you no longer use means opening .bash_history and editing it yourself
With bh

Type the characters you remember, in order.

Type the fragment you remember and the history narrows as you go. Characters may be spread out as long as the order holds, so you never have to recall the whole command.

REASON

Why it works

01A fragment is enough to reach the command

fzf-style fuzzy matching picks up any command whose characters appear in the order you typed them. Matches rank higher when the characters run together, land at the start of a word, or sit near the start of the command. An exact substring match always ranks above a fuzzy one.

A candidate list with the typed characters highlighted at intervals
02The order follows how you actually work

How recently you used a command and how often you use it give it a score, and the list is ordered by that score. A command typed only once is pushed well down, so typos never settle at the top. Before you type anything, only commands used twice or more are listed.

The list before anything is typed, with frequently used commands on top
03Shrink the history right where you searched it

C-x removes the highlighted command from ~/.bash_history, and Tab lets you pick several first. Every deletion asks y/N, so a search never turns into a deletion by accident.

Several commands selected, with the delete confirmation prompt showing
FUNCTION

Key features

The keybinding overlay that ? brings up
Fuzzy MatchingType gtp to find git push, gpl to find git pull. Characters may be spread out as long as the order holds, and the matched ones are highlighted as you type.
Ranked by Recency and FrequencyHow recently you used it and how often you use it decide the order. Commands used only once are pushed well down, so typos stay out of the way.
Noise Cut Only When There Is NoiseLow scorers are dropped only past 20 candidates; at 20 or fewer, everything shows. Narrowing your query never makes a result disappear.
Multi-Select and DeleteTab picks out several commands, and C-x clears them from ~/.bash_history in one go. With nothing multi-selected, only the highlighted command is affected.
Drop It Over Ctrl-RA few lines in .bashrc rebind Ctrl-R to bh. Piped, it returns the chosen command on stdout; run on its own, it executes the chosen command in your shell.
The Keys Your Hands Already KnowMove with ↑ / ↓ or C-p / C-n / C-k / C-j, half-page with C-u / C-d, edit the line with C-a / C-e / C-l. Press ? and the full list opens in place.

What it needs to run, and how it treats your history

Source code
Published under the MIT license. What it actually does can be read in the repository.
Requirements
The published binary is for Apple Silicon Macs. Anywhere else, cargo install --path . builds it from source.
Getting it
brew install senkentarou/tap/bh installs it, or unpack the tarball from GitHub Releases yourself.
Which shell
It reads ~/.bash_history and nothing else. zsh and fish histories are not supported.
Writing to the history
The only writes are deletions, and every one of them asks y/N first before dropping the matching lines from ~/.bash_history.
Network traffic
There is no networking code in it. Nothing it reads from your history ever leaves your machine.
Price
Free.

Give it a try

brew install senkentarou/tap/bh installs it, or grab the tarball straight from GitHub Releases.

Apple Silicon Mac · Reads bash history · Free (MIT)