Skip to content

iblocks-Xander/historian

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

historian

Command-line utility for managing shell history in a SQLite database.

~/.bash_history is deduped and imported into a database.

Requirements

  • SQLite
  • a home directory

Installation

Download and 1) add the directory to your $PATH

export PATH="$PATH:/Users/jerry/historian"

or 2) add hist as an alias.

alias hist="/Users/jerry/historian/hist"

Super Installation

Add hist import to your .profile (assuming hist is in your path):

$ echo hist import >> ~/.profile

This will import your .bash_history every time you launch a new shell.

Getting Started

Import your ~/.bash_history

$ hist import

Usage

Show config:

version:      0.0.1
bash_history: /Users/jerry/.bash_history
db:           /Users/jerry/.historian.db
sqlite3:      /opt/local/bin/sqlite3

Search:

$ hist search monsters
690
    echo a zombie with no conscience >> ~/monsters
689
    echo ghoul >> ~/monsters
688
    echo goblin >> ~/monsters
687
    echo lochness >> ~/monsters

Search (shorthand):

$ hist /monsters
690
    echo a zombie with no conscience >> ~/monsters
689
    echo ghoul >> ~/monsters
688
    echo goblin >> ~/monsters
687
    echo lochness >> ~/monsters

View log:

$ hist log
1020
    rm -f README.md
1019
    emacs README.md
1018
    rm -rf .git

Pitfalls

Live like your db file could be corrupted at any time.

Be wary of running specially crafted hist commands or against ~/.bash_history files.

Cool Things in the Future

  • export to append to ~/.bash_history
  • scrub items from history
  • set or autodetect configs
  • other shells than bash
  • timestamp support

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%