1
0
дзеркало https://github.com/quitesimpleorg/hs9001.git synced 2024-11-25 01:12:36 +01:00
Bash history put into sqlite so it can be searched
Go to file
2021-03-22 19:49:44 +01:00
.gitignore Init+ minor improvements 2021-03-20 20:18:27 +01:00
go.mod Init+ minor improvements 2021-03-20 20:18:27 +01:00
go.sum Init+ minor improvements 2021-03-20 20:18:27 +01:00
main.go search: concat multiple arguments. Don't just use the first 2021-03-22 19:49:44 +01:00
README.md Use exit status 23 as a do not log code 2021-03-21 12:45:26 +01:00

hs9001

hs90001 (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.

Setup

go build
#move hs9001 to a PATH location
# Initialize database
hs9001 init

Add this to .bashrc

if [ -n "$PS1" ] ; then
    PROMPT_COMMAND='hs9001 -ret $? add "$(history 1)"'
fi

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

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

Usage

hs9001 search "term"

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

alias searchh='hs9001 search'