hs9001/README.md

69 lines
2.0 KiB
Markdown
Raw Permalink 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.
2021-08-08 13:22:08 +02:00
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.
2021-03-21 10:54:47 +01:00
2021-08-08 13:22:08 +02:00
## Usage / Examples
### Search
2021-03-20 20:42:35 +01:00
```
2021-08-08 13:22:08 +02:00
hs [search terms]
```
You can further filter with options like `-cwd`, `-after` and so on...
For a full list, see `-help`.
```
2021-08-08 13:22:08 +02:00
hs -cwd .
```
Lists all commands ever entered in this directory
```
2021-09-25 13:40:34 +02:00
hs -today -cwd . git
2021-08-08 13:22:08 +02:00
```
Lists all git commands in the current directory which have been entered today.
2021-09-25 13:40:34 +02:00
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".
2021-08-08 13:22:08 +02:00
## 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
```
2021-08-08 13:22:08 +02:00
### From source
```
go build
#move hs9001 to a PATH location
```
2021-03-20 20:27:06 +01:00
Add this to .bashrc
2021-03-20 20:42:35 +01:00
```
eval "$(hs9001 bash-enable)"
2021-03-20 20:42:35 +01:00
```
2021-08-08 13:22:08 +02:00
This will also create a `hs`alias so you have to type less in everyday usage.
2021-09-25 13:40:34 +02:00
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.
2021-03-21 10:54:47 +01:00
```
export HS9001_DB_PATH="/home/db/history.sqlite"
```
2021-03-20 20:42:35 +01:00
2021-03-21 10:54:47 +01:00