hs9001/README.md

61 lines
1.3 KiB
Markdown
Raw Normal View History

2021-03-20 20:42:35 +01:00
# hs9001
hs9001 (history search 9001) is an easy, quite simple bash history enhancement. It simply writes all
2021-03-21 10:54:47 +01:00
your bash commands into an sqlite database. You can then search this database.
## Install
### From source
2021-03-20 20:42:35 +01:00
```
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
2021-03-20 20:27:06 +01:00
Add this to .bashrc
2021-03-20 20:42:35 +01:00
```
2021-03-20 20:27:06 +01:00
if [ -n "$PS1" ] ; then
PROMPT_COMMAND='hs9001 add -ret $? "$(history 1)"'
2021-03-20 20:27:06 +01:00
fi
2021-03-20 20:42:35 +01:00
```
By default, every system user gets his own database. You can override this by setting the environment variable
2021-03-21 10:54:47 +01:00
for all users that should write to your unified database.
```
export HS9001_DB_PATH="/home/db/history.sqlite"
```
2021-03-20 20:42:35 +01:00
## Usage
### Search
2021-03-21 10:54:47 +01:00
2021-03-20 20:42:35 +01:00
```
hs9001 search [search terms]
2021-03-20 20:42:35 +01:00
```
2021-03-21 10:54:47 +01:00
It is recommended to create an alias for search to make life easier, e. g.:
```
alias searchh='hs9001 search'
```