pixd
—
colourful binary file visualizer
pixd |
[-r range]
[-w width]
[file ...] |
pixd
visualizes binary data by mapping each octet to a
colour according to a palette, displaying the octet at a given number of
columns per line. pixd
will process the files
specified as arguments, or standard input if none are provided.
Note that pixd
uses 24-bit colour SGR
sequences and the U+2580 UPPER HALF BLOCK glyph for rendering. This means
that your terminal emulator needs to support both Unicode and 24-bit colour
sequences.
The default palette maps the high nibble into a hue, and the low
nibble into a brightness value. The hues used are black
(0x00
), red-orange
(0x01..0x1F
), yellow
(0x20..0x3F
), green
(0x40..0x7F
), cyan-blue
(0x80..0xBF
), purple-pink
(0xC0..0xFE
), and white
(0xFF
).
If no file operands are specified, standard input is read
instead. Available options are listed below.
-r
range
- Range of octets to print from each file. Specified as either
start-end or start+count, where
start and end/count
are positive integers specified in either decimal, hexadecimal or octal
(C-style notation).
When the former syntax is used, both ends of the range are
optional and default to the start or end of the file when omitted.
-w
width
- Number of octets per line, separated into groups (see
-g
). Set to 64
by
default.
PIXD_COLORS
can be used to override the colour palette.
If set, it should consist of 256 whitespace-separated hex colours; each colour
has to be exactly 6 hexadecimal digits representing a 24-bit colour (e.g.
FFFF00 for yellow).
Here are some examples of useful uses of hexd's features.
- pixd -r0x1000+0x200 foo.bin
- Display the 512-byte range in 'foo.bin' starting at offset 0x1000. Useful
when files contain other embedded files/formats at a certain location
(e.g. archive files).
- pixd -r-0x400 *.bin
- Show the first 1024 bytes of each of the *.bin files, with a heading above
each file (if more than one). This is useful for example to compare
headers of several samples of an unknown format.
- curl -s http://example.com | pixd |
less -R
pixd
works as a filter, too. For paging,
less(1)'s
-R
flag is useful.
Written by Jonas ‘FireFly’ Höglund.