cmd-tracker is an npm package that automatically captures, categorizes and saves every terminal command you type in a project.
Perfect for:
- π Students learning Linux, Git, Docker, Angular etc.
- π¨βπ» Developers who want to track commands used in a project
- π Anyone who wants to revise terminal commands they've used
You work normally in terminal
β
Commands auto-captured in background
β
Saved to .tracker/commands.json in your project
β
Run tracker list β see entire command history
Install in your learning/project repo:
npm install @adithya-naik/cmd-trackerStep 1 β Initialize in your repo:
npx tracker initStep 2 β Enable automatic capture:
npx tracker hook
source ~/.bashrc # bash
source ~/.zshrc # zsh (Mac)
source ~/.config/fish/config.fish # fishStep 3 β Work normally! Then revise:
npx tracker listThat's it! Every command you type is now saved automatically πͺ
| Command | Description |
|---|---|
tracker init |
Initialize tracker in your project |
tracker hook |
Enable automatic command capture |
tracker unhook |
Disable automatic command capture |
tracker list |
Show all saved commands |
tracker list <category> |
Filter by category |
tracker search <query> |
Search through commands |
tracker stats |
Show statistics by category |
tracker favorite <cmd> |
Toggle command as favorite |
tracker favorites |
Show all favorites |
tracker export |
Export as JSON |
tracker export --csv |
Export as CSV (opens in Excel) |
tracker clear |
Clear all commands |
tracker clear <category> |
Clear specific category |
Commands are automatically categorized into:
| Category | Commands |
|---|---|
π git |
git status, git push, git commit... |
π¦ npm |
npm install, npx, npm run... |
π³ docker |
docker ps, docker build... |
π§ linux |
ls, cd, mkdir, chmod... |
π’ node |
node, nodemon... |
π΄ angular |
ng new, ng serve, ng generate... |
π python |
python, pip install... |
π· go |
go build, go run, go get... |
β java |
java, javac, mvn, gradle... |
π¦ rust |
cargo build, cargo run, rustc... |
π· dotnet |
dotnet run, dotnet build... |
βΈοΈ kubernetes |
kubectl get pods, helm install... |
ποΈ database |
mysql, psql, mongosh, redis-cli... |
βοΈ cloud |
aws s3 ls, gcloud, az login... |
π₯ packageManagers |
yarn, pnpm, brew, snap... |
π§ͺ testing |
jest, vitest, playwright, cypress... |
π€ ai |
claude, gemini, opencode, aider... |
π others |
everything else |
Filter by category:
tracker list git # see all git commands
tracker list linux # see all linux commands
tracker list npm # see all npm commandsSearch commands:
tracker search "install" # find all install commands
tracker search "git" # find all git related commandsSave favorites for quick revision:
tracker favorite "git rebase -i HEAD~3"
tracker favorites # see all starred commandsExport for sharing/backup:
tracker export # creates tracker-export.json
tracker export --csv # creates tracker-export.csv (opens in Excel!)After running tracker init, a .tracker folder is created:
your-project/
βββ .tracker/
β βββ commands.json β your personal command history
βββ your-files...
βββ package.json
β
.tracker/is automatically added to.gitignoreYour command history stays local β never pushed to GitHub
Security is a core priority of cmd-tracker. Before any command is written to .tracker/commands.json, it is automatically scanned for sensitive information.
If a command contains credentials such as API keys, access tokens passwords, or private keys, the sensitive value or credential segment is replaced with [REDACTED], while the rest of the command is preserved. This keeps your command history useful without exposing secrets.
export AWS_SECRET_ACCESS_KEY=mySecretKeyexport AWS_SECRET_ACCESS_KEY=[REDACTED]Another example:
curl -u sampleuser:examplePass https://api.example.comcurl -u [REDACTED] https://api.example.comThe sanitizer automatically detects and redacts:
- AWS credentials (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, etc.) - API keys
- Access tokens
- Authentication tokens
- Passwords
- Bearer tokens
- HTTP Basic Authentication credentials
curl -u/curl --usercredentials- GitHub Personal Access Tokens
- GitLab Personal Access Tokens
- Slack tokens
- SSH private keys
- PEM private keys
If a command consists entirely of sensitive information (for example, only a GitHub token or a private key), cmd-tracker will not save it.
Example:
Input
ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Result
Command not saved (contains only sensitive data)
This feature helps prevent accidental exposure of secrets while keeping your command history clean and useful.
- π Prevents credentials from being stored in
.tracker/commands.json - π Preserves the readable parts of commands for future reference
- π« Avoids saving commands that contain nothing except sensitive information
- π» Works automaticallyβno configuration required
| Platform | Support |
|---|---|
| Mac (zsh) | β Full support |
| Linux (bash) | β Full support |
| Windows (Git Bash) | β Supported |
| Windows (PowerShell) | |
| Fish | β Full support |
Windows CMD/PowerShell users: use
tracker save "command"manually or use Git Bash / WSL for automatic capture
Mac:
brew install fishUbuntu/Debian:
sudo apt install fishFedora:
sudo dnf install fishWindows (WSL):
sudo apt install fishnpx tracker init
npx tracker hook
source ~/.config/fish/config.fishThat's it! Every command you type in fish will now be saved automatically! π
Contributions are welcome! Feel free to:
- Open an issue for bugs or feature requests
- Submit a pull request
MIT Β© Jatoth Adithya Naik