2021-03-20 20:42:35 +01:00
|
|
|
# hs9001
|
2021-03-21 10:54:47 +01:00
|
|
|
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.
|
|
|
|
|
|
|
|
|
2021-03-20 20:42:35 +01:00
|
|
|
## Setup
|
|
|
|
```
|
|
|
|
go build
|
|
|
|
#move hs9001 to a PATH location
|
|
|
|
# Initialize database
|
|
|
|
hs9001 init
|
|
|
|
````
|
|
|
|
|
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
|
2021-03-21 12:45:26 +01:00
|
|
|
PROMPT_COMMAND='hs9001 -ret $? add "$(history 1)"'
|
2021-03-20 20:27:06 +01:00
|
|
|
fi
|
2021-03-20 20:42:35 +01:00
|
|
|
```
|
2021-03-21 10:54:47 +01:00
|
|
|
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"
|
|
|
|
```
|
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 "term"
|
|
|
|
```
|
|
|
|
|
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'
|
|
|
|
```
|
|
|
|
|