hexdump

Color-coded hex dump of files or stdin

hexdump prints a color-coded hex dump of files or stdin.

  • Byte categories colored by semantic meaning: null, whitespace, control chars, printable ASCII, non-ASCII.
  • Unicode border and separator characters (┌─┬─┐, ).
  • Consecutive identical rows collapsed into a single * line (squeezing).
  • Reads from a file or stdin.
  • Auto-disables color when output is not a TTY.

Color scheme

CategoryBytesColor
Null0x00bright black
ASCII whitespace0x09 0x0A 0x0C 0x0D 0x20green
ASCII control chars0x01–0x08 0x0B 0x0E–0x1F 0x7Fgreen
Printable ASCII0x21–0x7Ecyan
Non-ASCII0x80–0xFFyellow

Demo

$ echo "Hello, World!" | hexdump --no-color
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 48 65 6c 6c 6f 2c 20 57 ┊ 6f 72 6c 64 21 0a       │Hello, W┊orld!_  │
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘

Options

FlagShortDescription
--length-nOnly read N bytes
--skip-sSkip N bytes from the start
--colorWhen to use colors: always, auto, never (default: auto)
--no-squeezingPrint all rows, do not collapse repeated rows
--print-color-tablePrint a color reference table and exit
--version-vPrint version
--help-hPrint help

Examples

Dump a file

1
hexdump /bin/ls | head -20

Inspect the first 64 bytes

1
hexdump -n 64 file.bin

Skip a header and dump the next 128 bytes

1
hexdump -s 16 -n 128 file.bin

Pipe from another command

1
curl -s https://example.com | hexdump | head -20