Stop losing context. cmdlog is a lightweight Zsh plugin that tracks execution time, git branch, conda/venv environment, and exit codes for every command you run.
Unlike standard shell history, cmdlog answers:
- Where did I run that command?
- Which git branch was active?
- Why did it fail? (Exit code)
- How long did it take?
- π Duration Tracking: Automatically logs execution time if >3 seconds (e.g.,
[2m4s]) - πΏ Git Aware: Captures the active branch for every command
- π Env Aware: Logs your Conda or Venv environment
- β Exit Codes: Tracks failures so you can filter for what worked vs. what broke
- π Powerful Querying: Built-in aliases to search, filter, and analyze history
- β‘ Zero Latency: Uses native Zsh hooks for zero perceptible lag
Run this single command to install cmdlog:
curl -fsSL https://raw.githubusercontent.com/smaxiso/cmdlog/main/install.sh | bash-
Clone this repository:
git clone https://github.com/smaxiso/cmdlog.git ~/.cmdlog -
Source it in your
~/.zshrc:source ~/.cmdlog/cmdlog.zsh
-
Reload your shell:
source ~/.zshrc
Once installed, your commands are automatically logged. Use these aliases to query them:
| Command | Description |
|---|---|
cmdlog [N|all] |
View the last N commands (default: 20) or all history |
cmd-here [N|all] |
Show commands run in the current directory (default: 20) |
cmd-git |
Show git-related commands only |
cmd-errors |
Show only failed commands (non-zero exit code) |
cmd-stats |
Show usage statistics (top commands, failure rate) |
cmdsearch <term> |
Search for a specific command keyword |
Go to the project folder and run:
cmd-here allThis shows every command ever run inside that specific folder.
See the very last commands you ran:
cmd-todayFilter for commands that returned a non-zero exit code:
cmd-errorsOpen a new terminal pane and watch commands being logged live:
cmdliveBy default, history is saved to ~/.global_history. You can change this by setting the variable before sourcing the script:
export GLOBAL_HISTORY_FILE="$HOME/.my_custom_history_file"
source ~/.cmdlog/cmdlog.zshMIT