Bash history put into sqlite so it can be searched
Go to file
Albert S. bb2450b8ec history: Only start search when at least 2 chars have been entered
Starting search with the first character leads to a noticable delay.
This hack ensures a more pleasant experience.
2021-08-08 12:38:25 +02:00
liner Implement bash CTRL-R reverse history 2021-08-08 11:40:33 +02:00
.gitignore Init+ minor improvements 2021-03-20 20:18:27 +01:00
LICENSE add LICENSE 2021-03-23 14:35:50 +01:00
Makefile Add 'version' command 2021-05-16 18:38:50 +02:00
README.md Replace previous PROMPT_COMMAND in bashrc with more convenient option 2021-06-05 15:42:33 +02:00
go.mod Implement bash CTRL-R reverse history 2021-08-08 11:40:33 +02:00
go.sum Implement bash CTRL-R reverse history 2021-08-08 11:40:33 +02:00
history.go history: Only start search when at least 2 chars have been entered 2021-08-08 12:38:25 +02:00
main.go Implement bash CTRL-R reverse history 2021-08-08 11:40:33 +02:00

README.md

hs9001

hs9001 (history search 9001) is an easy, quite simple bash history enhancement. It simply writes all your bash commands into an sqlite database. You can then search this database.

Install

From source

go build
#move hs9001 to a PATH location

Debian / Ubuntu

Latest release can be installed using apt

curl -s https://repo.quitesimple.org/repo.quitesimple.org.asc | sudo apt-key add -
echo "deb https://repo.quitesimple.org/debian/ default main" | sudo tee /etc/apt/sources.list.d/quitesimple.list
sudo apt-get update
sudo apt-get install hs9001

Alpine

wget https://repo.quitesimple.org/repo%40quitesimple.org-5f3d101.rsa.pub -O /etc/apk/repo@quitesimple.org-5f3d101.rsa.pub
echo "https://repo.quitesimple.org/alpine/quitesimple/" >> /etc/apk/repositories
apk update
apk add hs9001

Setup / Config

Add this to .bashrc

eval "$(hs9001 bash-enable)"

By default, every system user gets his own database. You can override this by setting the environment variable for all users that should write to your unified database.

export HS9001_DB_PATH="/home/db/history.sqlite"

Usage

hs9001 search [search terms]

It is recommended to create an alias for search to make life easier, e. g.:

alias searchh='hs9001 search'