Skip to main content

ccbashhistory

PyPI version Downloads/month Total downloads License: MIT Python 3.8+

Extract and analyze bash commands from Claude Code session history.

Usage

pipx run ccbashhistory

Run with no arguments to open the interactive session picker. It lists your recent Claude Code sessions (those active within the last 24 hours by default). Navigate with the arrow keys (or press the number shown next to a session for direct selection) and press Enter to view that session. Press q to quit. Selecting a session prints all of the bash commands Claude Code ran during it.

Options

Flag Description
(no flags) Open the interactive arrow-key session picker for the lookback window.
--hours N Set the lookback window, in hours, used to find recent sessions. Default: 24. Increase it to widen the window or decrease it to narrow it.
--export [PATH] Non-interactive mode. Export today's bash commands to a file instead of opening the picker. PATH is optional; when omitted the file is named cc_bash_commands_YYYY-MM-DD.txt in the current directory.
-h, --help Show the help message and exit.
--version Print the installed version and exit.

Examples:

# Interactive picker over the last 48 hours
ccbashhistory --hours 48

# Export today's commands to the default file (cc_bash_commands_YYYY-MM-DD.txt)
ccbashhistory --export

# Export today's commands to a specific path
ccbashhistory --export ~/bash-history.txt

The interactive picker works across macOS, Linux, and Windows: it uses native key reading on each platform (msvcrt on Windows, termios/tty on macOS and Linux) so arrow keys, number selection, and q to quit behave the same everywhere. The --export mode is fully non-interactive and works identically on all three operating systems.

Requirements

  • Python: 3.8 or higher
  • Operating System: macOS, Linux, or Windows
  • Claude Code: Installed with conversation history in ~/.claude/projects/

Development

# Clone the repository
git clone https://github.com/pdenya/ccbashhistory.git
cd ccbashhistory

# Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install in editable mode
pip install -e .

# Run without cache
pipx run --no-cache --spec . ccbashhistory

Publishing to PyPI

# Install build and twine
pip install build twine

# Build the package
python3 -m build

# Upload to PyPI (requires API token)
twine upload dist/*

Contributing

Contributions welcome! Please feel free to submit a Pull Request to github.com/pdenya/ccbashhistory.

License

MIT License

Release files for ccbashhistory 1.1.0

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

Source distribution (sdist)

Source distribution for ccbashhistory 1.1.0
File Size Uploaded
ccbashhistory-1.1.0.tar.gz 14.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ccbashhistory 1.1.0
File Interpreter ABI Platform
ccbashhistory-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / ccbashhistory-1.1.0.tar.gz

Download URL ccbashhistory-1.1.0.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4b6d6064d57e53fd40fd122dcd343eb002a54656c958ff976aad04afa2046449
BLAKE2b-256 checksum
How to use checksums
56794395c8b7b51ff53c2cd4a14c009b3b154046574295788a65e6431cf2f570
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / ccbashhistory-1.1.0-py3-none-any.whl

Download URL ccbashhistory-1.1.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f165ae2a2bc47e1ea260dd9a3f11326f39189265a906f52df65ab01752784ad5
BLAKE2b-256 checksum
How to use checksums
e8533d0ccb2ce709caf7fbd0e8c744ba85a137a7fcd0c6f3d4124007f45ea638
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

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