Everyone loves a Wrapped — a few flattering stats, one mildly embarrassing stat, one personality label. Raw numbers don’t go viral; stories do. So I built terminal-wrapped: a bash script that turns ~/.zsh_history into your year in commands.
What it does
One script, two outputs:
- Pretty report — hero stats (total commands, unique, favorite, sudo %, midnight sessions), a derived “personality label”, top-10 commands with bars, a monthly activity heatmap, one embarrassing stat, and fun facts.
- JSON mode (
--json) — structured stats that any future “wrapped engine” can consume to render a shareable card.
The tech bit
Speed matters when the history is 7k+ lines. Calling date per line is the naive approach — too slow. Instead:
- awk pulls
timestamp\tcommandpairs out of the history in a single pass - perl converts timestamps to date fields in one batch (no per-line child processes)
- awk again computes all stats — top commands with a numeric (not string) sort, sudo %, midnight count, per-month buckets, longest command
Everything else (personality detection, the bar charts) is plain bash.
The recipe I’ll reuse
This follows a pattern I’m deliberately collecting across projects:
raw stats → personality label → shareable card → embarrassment bait
Same pipeline, different data source: Obsidian notes, browser history, Jellyfin watches, stashed.in saves (“You saved 412 links. You read 17.”). The JSON stage is the reusable core — one card template, swap the parser.
Try it
git clone https://github.com/ooexiaoo/terminal-wrapped
cd terminal-wrapped && ./terminal-wrapped.sh # this year
WRAPPED_YEAR=2025 ./terminal-wrapped.sh # a specific year
./terminal-wrapped.sh --json # structured output
My own 2026: 4,159 commands, favorite cd (1,015×), 379 midnight sessions — personality: The One-Trick Penguin. 🐧