Manage command history using text-based user interface.

Inspect hstr application.

$ sudo apt info hstr
Package: hstr
Version: 2.3+ds-1
Priority: optional
Section: utils
Maintainer: Daniel Echeverri
Installed-Size: 74.8 kB
Depends: libc6 (>= 2.29), libncursesw6 (>= 6), libreadline8 (>= 6.0), libtinfo6 (>= 6)
Homepage: https://github.com/dvorka/hstr
Tag: uitoolkit::ncurses
Download-Size: 26.9 kB
APT-Sources: https://deb.debian.org/debian bullseye/main arm64 Packages
Description: Suggest box like shell history completion

Install hstr application.

$ sudo apt install hstr

Display configuration (bash).

$ hstr --show-configuration 
# HSTR configuration - add this to ~/.bashrc
alias hh=hstr                    # hh to be alias for hstr
export HSTR_CONFIG=hicolor       # get more colors
shopt -s histappend              # append new history items to .bash_history
export HISTCONTROL=ignorespace   # leading space hides commands from history
export HISTFILESIZE=10000        # increase history file size (default is 500)
export HISTSIZE=${HISTFILESIZE}  # increase history size (default is 500)
# ensure synchronization between bash memory and history file
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
# if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi
# if this is interactive shell, then bind 'kill last command' to Ctrl-x k
if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi

Source this configuration in.

$ source <(hstr --show-configuration)

Make configuration permanent.

$ hstr --show-configuration | tee ~/.bashrc

Inspect command history using hstr command, hh alias, or ctrl-r key strokes.

$ hh

Display favorites.
These are added using ctrl-f key stroke and stored inside ~/.hstr_favorites file.

$ hstr --favorites

Display blacklist.
These are stored inside ~/.hstr_blacklist file (the built-in blacklist is used if this file missing).

$ hstr --show-blacklist
Command blacklist (14):
  'pwd '
  'mc '
  'ls '
  'hstr '
  'hstr'
  'pwd'
  'cd '
  'hh '
  'cd ..'
  'cd .. '
  'cd'
  'hh'
  'mc'
  'ls'

Play more with it to get a better grasp of its functionality. Enjoy!

ko-fi