Inspecting raw binary files, debugging compiled binaries, and reverse-engineering network packets typically involves invoking classic command-line utilities like hexdump, xxd, or od. While these time-tested tools are universally available, their monochrome output makes scanning through large binary blobs fatiguing and slow. hexyl is a modern command-line hex viewer written in Rust that incorporates coloured byte categorisation, distinct column separators, and integrated character previews to dramatically accelerate binary analysis.
What Sets hexyl Apart from Traditional Hex Dumpers?
Developed by David Peter (creator of bat and fd), hexyl applies terminal colour palettes to convey structural information about binary data at a single glance:
- Coloured Byte Categorisation: Differentiates NULL bytes, printable ASCII characters, control codes, and non-ASCII high bytes using dedicated colours.
- Clear Visual Hierarchy: Splits output into aligned panels displaying hexadecimal offsets, 16-byte raw data columns, and ASCII decoded representations.
- Squeeze Redundant Lines: Collapses repeated identical rows using asterisks to keep output concise without losing positional context.
- Flexible Input Support: Reads binary streams from local file paths or standard input pipelines seamlessly.
Understanding hexyl Colour Coding
| Byte Category | Visual Styling | Hexadecimal Range |
|---|---|---|
NULL Bytes (0x00) |
Dim / Faded Grey | 00 |
| Printable ASCII | Bright Cyan / Green | 20 through 7E |
| ASCII Whitespace | Bright Green | 09 (Tab), 0A (LF), 0D (CR) |
| Control Characters | Deep Red / Magenta | 01–1F and 7F |
| Non-ASCII High Bytes | Vibrant Yellow / Orange | 80 through FF |
Installing hexyl Across Linux Distributions
The hexyl package is available in official repositories across major distributions.
Installing on Ubuntu, Debian, and Linux Mint
On modern Debian and Ubuntu releases, install directly from official apt repositories:
sudo apt update
sudo apt install hexyl
Installing on Arch Linux and Manjaro
Arch Linux includes hexyl in its extra repositories:
sudo pacman -S hexyl
Installing via Cargo (Any Distribution)
Compile and install directly with Rust’s Cargo package manager:
cargo install hexyl
Core Usage and Command-Line Flags
To inspect any binary file, pass its path to hexyl:
hexyl image.png
You can refine the output using several powerful filtering options:
1. Limiting Byte Output Length (-n)
When inspecting large binaries where you only need to examine file headers or magic numbers, limit the inspection size with -n:
# Inspect the first 256 bytes of an executable
hexyl -n 256 /bin/bash
2. Setting Offset Position (-r)
To skip initial header data and jump straight to an embedded data payload at a specific byte offset:
# Start viewing from byte offset 1024 to 2048
hexyl -r 1024:2048 firmware.bin
3. Piping Data from Pipelines
Inspect output directly from network sockets, encryption commands, or compressed archives without saving temporary files:
head -c 64 /dev/urandom | hexyl
Customising Terminal Display Options
Adapt hexyl to match terminal dimensions or documentation preferences:
--border <style>: Select border formatting styles such asunicode,ascii, ornone.--panels <n>: Display 8, 16, or 24 bytes per line to match wide or narrow displays.--color never: Strip terminal escape codes when redirecting output to plain text notes.
By replacing traditional monochrome hex dumps with hexyl, developers and security researchers gain immediate visual clarity when analysing binary formats and packet traces.