binpeek is a minimalist hexdump utility inspired by xxd, rewritten in Zig for performance and simplicity. It displays binary files in hexadecimal and ASCII side by side, with configurable colour highlighting — handy for low-level analysis and debugging.
- Hexadecimal and ASCII side-by-side view.
- Colour highlighting by byte category (printable, escape, format, other), configurable via a TOML file.
- Colour is automatic: on when writing to a terminal, off when piped or redirected (override with
--color). - Reads from a file or from standard input.
xxd-style options: seek, length limit, custom column width, and plain hex output.- Written in Zig for speed and cross-platform compatibility.
-
Ensure Zig v0.16.0 or later is installed.
-
Clone the repository:
git clone https://github.com/strvdr/binpeek
-
Build:
cd binpeek zig build -Doptimize=ReleaseFastThe binary is produced at
zig-out/bin/binpeek. -
Optional — install it on your
PATHand add the config:cp zig-out/bin/binpeek /usr/local/bin/ # may require sudo cp .config/binpeek.toml ~/.config/
Note:
zig buildonly updateszig-out/bin/binpeek. If you previously copiedbinpeekinto/usr/local/bin(or elsewhere on yourPATH), re-run the copy above after rebuilding, otherwisebinpeekwill keep running the old binary.
binpeek [options] [file]With no file (or -), binpeek reads from standard input.
| Option | Description |
|---|---|
-c, --cols N |
Bytes per row (default 16). |
-s, --seek N |
Skip N bytes before dumping. |
-l, --length N |
Dump at most N bytes. |
-p, --plain |
Plain continuous hex, no offsets/ASCII/colour (like xxd -p). |
--color=WHEN |
Colourize: auto (default), always, or never. |
-h, --help |
Show help. |
N accepts decimal or 0x-prefixed hex (e.g. -l 0x40).
binpeek file.bin # dump a file
binpeek -s 0x100 -l 64 file.bin # 64 bytes starting at offset 0x100
binpeek -c 8 file.bin # 8 bytes per row
cat file.bin | binpeek # read from stdin
binpeek -p file.bin # plain hex, pipe-friendly
binpeek --color=always file.bin | less -R00000000: 7f45 4c46 0201 0100 0000 0000 0000 0000 .ELF............
00000010: 0300 3e00 0100 0000 1010 0000 0000 0000 ..>.............
binpeek supports colour customisation through ANSI escape codes, which work with most terminals and operating systems. Colours are read from ~/.config/binpeek.toml; if the file is absent, sensible defaults are used.
Inside binpeek.toml, under a [Colors] table, you can set:
[Colors]
asciiColors = "green" # printable characters
binColors = "red" # other / binary bytes
formatColors = "blue" # format bytes (0x7f, 0xff)
escapeColors = "yellow" # whitespace/escape bytes (\t \n \r, 0x1a)Each value may be any of:
red green blue cyan yellow magenta
Contributions are welcome! Open an issue or submit a pull request for improvements or bug fixes.
binpeek depends on ztoml, a tiny TOML parser used to read the optional colour config. It is fetched automatically by zig build.
MIT © Strydr Silverberg
Inspired by xxd, built with Zig's simplicity in mind.🧠