{"id":51119007,"url":"https://github.com/sulthonzh/shellstats","last_synced_at":"2026-06-25T00:30:37.501Z","repository":{"id":363219493,"uuid":"1255446394","full_name":"sulthonzh/shellstats","owner":"sulthonzh","description":"Analyze your shell history — most used commands, time patterns, sequences, and habits","archived":false,"fork":false,"pushed_at":"2026-06-17T01:56:55.000Z","size":21,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-17T03:24:39.338Z","etag":null,"topics":["analytics","bash","cli","history","shell","zsh"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sulthonzh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-31T20:50:46.000Z","updated_at":"2026-06-17T01:55:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sulthonzh/shellstats","commit_stats":null,"previous_names":["sulthonzh/shellstats"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sulthonzh/shellstats","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fshellstats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fshellstats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fshellstats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fshellstats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sulthonzh","download_url":"https://codeload.github.com/sulthonzh/shellstats/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulthonzh%2Fshellstats/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34755061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","bash","cli","history","shell","zsh"],"created_at":"2026-06-25T00:30:36.828Z","updated_at":"2026-06-25T00:30:37.496Z","avatar_url":"https://github.com/sulthonzh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shellstats\n\nAnalyze your shell history — most used commands, time patterns, command sequences, and habits you didn't know you had.\n\n## Why?\n\nYour shell history is a goldmine of data. You run hundreds of commands a day but never look back. `shellstats` turns that history into something useful: which commands you actually use, what time of day you're most productive, and what command sequences keep repeating.\n\nNo config. No setup. Just run it.\n\n## Install\n\n```bash\nnpm install -g shellstats\n```\n\nOr run it directly:\n\n```bash\nnpx shellstats\n```\n\n## Quick Start\n\n```bash\n# Analyze your default shell history\nshellstats\n\n# Force a specific shell\nshellstats --shell zsh\n\n# Top 10 commands, JSON output\nshellstats --top 10 --format json\n\n# Everything — sequences, time patterns, length stats\nshellstats --all\n\n# Analyze a specific history file\nshellstats ~/.bash_history --shell bash\n```\n\n## What It Shows\n\n### Top Commands\n\n```\nTop Commands:\n  git       142  (28.4%)  ██████████████\n  cd         89  (17.8%)  █████████\n  npm        45   (9.0%)  ████\n  ls         34   (6.8%)  ███\n  docker     28   (5.6%)  ██\n```\n\n### Command Sequences\n\nPatterns you repeat without thinking:\n\n```\nCommand Sequences:\n  git → git   (47x)\n  cd → ls     (31x)\n  npm → npm   (18x)\n  git → cd    (15x)\n```\n\n### Time Patterns\n\nWhen you actually type commands (zsh/fish only — bash doesn't store timestamps):\n\n```\nPeak hour: 14:00 | Peak day: Tue\nHourly distribution:\n  00:00  ▓ 1.2%\n  01:00  ▓ 0.4%\n  ...\n  14:00  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 15.3%\n```\n\n### Command Length Stats\n\n```\nCommand Lengths: avg 18.4 chars, median 15, p95 42, range 2-187\n```\n\n### Uniqueness\n\n```\nUnique Commands: 312/500 (62.4% unique)\n```\n\n## CLI Options\n\n```\nshellstats [options] [history-file]\n\nOptions:\n  --shell \u003cbash|zsh|fish\u003e   Shell type (default: auto-detect from $SHELL)\n  --top \u003cn\u003e                 Top N commands to show (default: 20)\n  --format \u003ctext|json|md\u003e   Output format (default: text)\n  --sequences               Show command sequences\n  --times                   Show time patterns\n  --lengths                 Show command length stats\n  --all                     Show all sections\n  -h, --help                Show help\n```\n\n## Output Formats\n\n### Text (default)\n\nHuman-readable with unicode bars. Good for terminals.\n\n### JSON\n\nMachine-readable. Pipe it into `jq`, use it in scripts.\n\n```bash\nshellstats --format json | jq '.frequency[0]'\n```\n\n### Markdown\n\nNice for sharing. Tables work in GitHub, Notion, etc.\n\n```bash\nshellstats --format md \u003e my-shell-report.md\n```\n\n## Supported Shells\n\n| Shell | History File | Timestamps |\n|-------|-------------|------------|\n| bash  | `~/.bash_history` | No |\n| zsh   | `~/.zsh_history` | Yes |\n| fish  | `~/.local/share/fish/fish_history` | No |\n\nAuto-detects your shell from `$SHELL`. Pass `--shell` to override.\n\n## Smart Command Extraction\n\n`shellstats` doesn't just count raw strings. It extracts the *base command*:\n\n- `sudo apt update` → `apt`\n- `git log --oneline` → `git`\n- `cat file.txt | grep foo` → `cat` (takes first command in pipe)\n- `make \u0026\u0026 make install` → `make` (takes first in chain)\n- `/usr/bin/node server.js` → `node` (strips path)\n- `doas vim /etc/rc.conf` → `vim`\n\nThis means `git status`, `git add .`, and `git push` all count as `git` — which is usually what you want.\n\n## Programmatic API\n\n```javascript\nconst { analyze, formatText, formatJSON, formatMarkdown } = require('shellstats');\n\nconst result = analyze(null, { shell: 'zsh', top: 15 });\nconsole.log(formatText(result));\n\n// Or access raw data\nconsole.log(result.frequency);     // [{ command, count, pct }, ...]\nconsole.log(result.sequences);     // [{ sequence, count }, ...]\nconsole.log(result.timePatterns);  // { hourly, daily, peakHour, peakDay }\nconsole.log(result.lengths);       // { avg, min, max, median, p95 }\nconsole.log(result.duplicates);    // { total, unique, duplicate, uniquePct }\n```\n\n## Use Cases\n\n- **Curious about your habits?** Run `shellstats` and see what you actually type all day.\n- **Cleaning up aliases?** Find your most-used commands and alias the long ones.\n- **Team insights?** Compare shell stats across your team (share the markdown output).\n- **Scripting?** Use JSON output to build dashboards or trigger alerts.\n- **Onboarding?** See what commands a new team member is using most.\n\n## Zero Dependencies\n\nNo dependencies. Just Node.js \u003e= 16.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulthonzh%2Fshellstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsulthonzh%2Fshellstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulthonzh%2Fshellstats/lists"}