Configs2026年4月15日·1 分钟阅读

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.

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

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产