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
| Category | Bytes | Color |
|---|---|---|
| Null | 0x00 | bright black |
| ASCII whitespace | 0x09 0x0A 0x0C 0x0D 0x20 | green |
| ASCII control chars | 0x01–0x08 0x0B 0x0E–0x1F 0x7F | green |
| Printable ASCII | 0x21–0x7E | cyan |
| Non-ASCII | 0x80–0xFF | yellow |
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
| Flag | Short | Description |
|---|---|---|
--length | -n | Only read N bytes |
--skip | -s | Skip N bytes from the start |
--color | When to use colors: always, auto, never (default: auto) | |
--no-squeezing | Print all rows, do not collapse repeated rows | |
--print-color-table | Print a color reference table and exit | |
--version | -v | Print version |
--help | -h | Print help |
Examples
Dump a file
| |
Inspect the first 64 bytes
| |
Skip a header and dump the next 128 bytes
| |
Pipe from another command
| |