log bash history to an sqlite database
Project description
Recent is a more structured way to log your bash history.
The standard ~/.bash_history file is inadequate in many ways, its worst fault is to by default log only 500 history entries, with no timestamp. You can alter your bash HISTFILESIZE and HISTTIMEFORMAT variables but it is still a unstructured format with limited querying ability.
Recent does the following:
Logs current localtime, command text, current pid, command return value, working directory to an sqlite database in ~/.recent.db.
Logs history immediately, rather than at the close of the session.
Provides a command called recent for searching logs.
installation instructions
You need will need sqlite installed.
Install the recent pip package:
pip install recent
Add the following to your .bashrc or .bash_profile:
export PROMPT_COMMAND='log-recent -r $? -c "$(HISTTIMEFORMAT= history 1)" -p $$'
And start a new shell.
usage
Look at your current history using recent:
recent
Search for a pattern as follows:
recent git
For more information see the help:
recent -h
Not currently recent doesn’t integrate with bash commands such as Ctrl-R, but this is in the pipeline.
You can directly query your history using the following:
sqlite3 ~/.recent.db "select * from commands limit 10"
dev installation instructions
git clone https://github.com/trengrj/recent && cd recent
pip install -e .
security
Please note, recent does not take into account enforcing logging for security purposes. For this functionality on linux, have a look at auditd http://people.redhat.com/sgrubb/audit/.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file recent-0.1.3.tar.gz
.
File metadata
- Download URL: recent-0.1.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a16d408258301c935d6e2f2963e022aa3a5db6d53bbc59e482be2dce93ba6d09 |
|
MD5 | 2785a74857be1d0c532dda1794fe6a5e |
|
BLAKE2b-256 | f30e7062d210934f6374c6cb487e4cf94669ae92e881d1c15437b52a2ad62bc2 |
File details
Details for the file recent-0.1.3-py2.py3-none-any.whl
.
File metadata
- Download URL: recent-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 645739745f32386845079021a275ac40eb566d390953a6bb01341f733ae49526 |
|
MD5 | 31a2e34f8c26d44cf3af691764579d02 |
|
BLAKE2b-256 | cd2295ca7c413e6ba891d9099b92d9f468c99c9824fb88daa745c5159004ce22 |