Extract and analyze bash commands from Claude Code session history
Project description
ccbashhistory
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
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ccbashhistory-1.1.0.tar.gz.
File metadata
- Download URL: ccbashhistory-1.1.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b6d6064d57e53fd40fd122dcd343eb002a54656c958ff976aad04afa2046449
|
|
| MD5 |
9126798fcb7cdf0580ae97ebdf8adcc9
|
|
| BLAKE2b-256 |
56794395c8b7b51ff53c2cd4a14c009b3b154046574295788a65e6431cf2f570
|
File details
Details for the file ccbashhistory-1.1.0-py3-none-any.whl.
File metadata
- Download URL: ccbashhistory-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f165ae2a2bc47e1ea260dd9a3f11326f39189265a906f52df65ab01752784ad5
|
|
| MD5 |
1d1561354e0338c077ef39cf4daf8037
|
|
| BLAKE2b-256 |
e8533d0ccb2ce709caf7fbd0e8c744ba85a137a7fcd0c6f3d4124007f45ea638
|