# hexyl — A Colorful Command-Line Hex Viewer > hexyl is a small, fast Rust hex viewer that colorizes bytes by category (ASCII, whitespace, non-ASCII, null) so binary inspection is actually scannable. ## Install Save in your project root: # hexyl — A Colorful Command-Line Hex Viewer ## Quick Use ```bash brew install hexyl # Inspect binary hexyl /bin/ls | head # Only offset 0x1000 – 0x1040 hexyl --skip 4096 --length 64 file.bin # From stdin curl -s https://example.com/image.png | hexyl | head ``` ## Introduction Classic `xxd` and `hexdump` print raw hex blocks without visual hierarchy — every byte looks the same. `hexyl` categorizes each byte into ASCII printable, ASCII whitespace, non-ASCII printable, or NULL/control, and tints each class differently. Scanning for magic numbers, string offsets, or corruption becomes a visual rather than algebraic task. ## What hexyl Does - Prints offset, hex bytes, and ASCII sidebar. - Colorizes bytes by category. - Accepts file paths or stdin. - Supports `--skip`, `--length`, `--nosqueeze`, `--border` options. - Uses terminal width to fit panel count. ## Architecture Overview hexyl reads bytes in large chunks, classifies each with a table lookup, and pipes styled ANSI through `termcolor`. Panels auto-adjust to terminal width. No background threads — a simple synchronous Rust binary. ## Self-Hosting & Configuration - Install via brew, cargo, apt, dnf, scoop. - Config is entirely flags — no dotfiles. - `NO_COLOR=1` for monochrome. - Useful with `less -R` or `bat`. - Pairs with `fd | xargs hexyl` for batch preview. ## Key Features - Colored byte categories — scan like a pro. - Stdin-friendly for network/streaming inspection. - `--skip`/`--length` for targeted windows. - Nice borders and offset hints. - ~1.5MB static binary. ## Comparison with Similar Tools - **xxd** — ubiquitous; no color. - **hexdump -C** — POSIX; dense, no hierarchy. - **bvi / hte** — interactive hex editors. - **radare2** — full reverse-engineering toolkit; overkill for viewing. - **Hex Fiend** — macOS GUI. ## FAQ **Q: Can it edit files?** A: No — read-only. Use bvi or radare2 to edit. **Q: Unicode-safe?** A: It shows bytes, not glyphs — UTF-8 multi-byte chars appear as non-ASCII group. **Q: Panel count?** A: Auto-sized; override with `--panels 2`. **Q: Works in CI logs?** A: Pass `--color always` or pipe through `aha` for HTML. ## Sources - https://github.com/sharkdp/hexyl --- Source: https://tokrepo.com/en/workflows/44b21bb2-38c4-11f1-9bc6-00163e2b0d79 Author: AI Open Source