Bash history put into sqlite so it can be searched
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Albert S. d0e07640e8 Update README.md 4 weeks ago
liner Implement mode for reverse search in cwd 4 weeks ago
.gitignore Init+ minor improvements 7 months ago
LICENSE add LICENSE 7 months ago
Makefile Add 'version' command 5 months ago
README.md Update README.md 4 weeks ago
go.mod Implement bash CTRL-R reverse history 3 months ago
go.sum Implement bash CTRL-R reverse history 3 months ago
history.go Implement mode for reverse search in cwd 4 weeks ago
main.go Implement --today 4 weeks ago

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.

It improves over bash's built-in history mechanism as it'll aggregate the shell history of all open shells, timestamp them and also record additional information such as the directory a command was executed in.

Usage / Examples

hs [search terms]

You can further filter with options like -cwd, -after and so on... For a full list, see -help.

hs -cwd . 

Lists all commands ever entered in this directory

hs -today -cwd . git

Lists all git commands in the current directory which have been entered today.

Also, it (by default) replaces bash's built-in CTRL-R mechanism, so hs9001's database will be used instead of bash's limited history files.

When in reverse-search mode, you can only search the history of the current directory by pressing CTRL+A and then "w".

Install

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

From source

go build
#move hs9001 to a PATH location

Add this to .bashrc

eval "$(hs9001 bash-enable)"

This will also create a hsalias so you have to type less in everyday usage.

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"