Skip to main content

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.1

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.1
File Size Uploaded Provenance Actions
recent-0.1.1.tar.gz 4.7 kB Without provenance Details for recent-0.1.1.tar.gz

Release files / recent-0.1.1.tar.gz

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

Security for recent 0.1.1

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