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

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.3
File Size Uploaded
recent-0.1.3.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for recent 0.1.3
File Interpreter ABI Platform
recent-0.1.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 11.3 kB

Release files / recent-0.1.3.tar.gz

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

Release files / recent-0.1.3-py2.py3-none-any.whl

Download URL recent-0.1.3-py2.py3-none-any.whl
Size 6.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
645739745f32386845079021a275ac40eb566d390953a6bb01341f733ae49526
BLAKE2b-256 checksum
How to use checksums
cd2295ca7c413e6ba891d9099b92d9f468c99c9824fb88daa745c5159004ce22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.0.3

2 release files

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