Skip to main content

recent

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:

  1. Logs current localtime, command text, current pid, command return value, working directory to an sqlite database in ~/.recent.db.

  2. Logs history immediately, rather than at the close of the session.

  3. 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/.

Metadata

Release files for recent 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for recent 0.1.2
File Size Uploaded Provenance Actions
recent-0.1.2.tar.gz 4.7 kB Without provenance Details for recent-0.1.2.tar.gz

Release files / recent-0.1.2.tar.gz

Download URL recent-0.1.2.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a8367626de704df5a1218d37512db69f2cc7fb0b4c269b3eb3f8eeed21f105a0
BLAKE2b-256 checksum
How to use checksums
5a39cc9569f4b9dd7d5a4814acada31b6b7befd3eaaf83a649b0a9c839a83726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for recent 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page