-
Notifications
You must be signed in to change notification settings - Fork 38
/
pixd.1
107 lines (107 loc) · 2.53 KB
/
pixd.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
.Dd May 25, 2017
.Dt PIXD 1
.Os
.Sh NAME
.Nm pixd
.Nd colourful binary file visualizer
.Sh SYNOPSIS
.Nm
.Op Fl r Ar range
.Op Fl w Ar width
.Op Ar
.Sh DESCRIPTION
.Nm
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.
.Nm
will process the files specified as arguments, or standard input if none are
provided.
.Pp
Note that
.Nm
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.
.Pp
The default palette maps the high nibble into a hue, and the low nibble into a
brightness value.
The hues used are
.Em black
.Li ( 0x00 ) ,
.Em red-orange
.Li ( 0x01..0x1F ) ,
.Em yellow
.Li ( 0x20..0x3F ) ,
.Em green
.Li ( 0x40..0x7F ) ,
.Em cyan-blue
.Li ( 0x80..0xBF ) ,
.Em purple-pink
.Li ( 0xC0..0xFE ) ,
and
.Em white
.Li ( 0xFF ) .
.Sh OPTIONS
If no
.Ar file
operands are specified, standard input is read instead.
Available options are listed below.
.Bl -tag -width Ds
.It Fl r Ar range
Range of octets to print from each file.
Specified as either
.Em start-end
or
.Em start+count ,
where
.Em start
and
.Em end Ns / Ns Em count
are non-negative integers specified in either decimal, hexadecimal or octal
(C-style notation).
.Pp
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.
.It Fl w Ar width
Number of octets per line, separated into groups (see
.Fl g ) .
Set to
.Li 64
by default.
.El
.Sh ENVIRONMENT
.Ev 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.
.Em FFFF00
for yellow).
.Pp
.Sh EXAMPLES
Here are some examples of useful uses of hexd's features.
.Bl -tag -width Ds
.It Em 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).
.It Em 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.
.It Em curl -s http://example.com | pixd | less -R
.Nm
works as a filter, too. For paging,
.Xr less 1 Ns 's
.Fl R
flag is useful.
.El
.Sh SEE ALSO
.Xr hexd 1 ,
.Xr hexdump 1 ,
.Xr xxd 1
.Sh AUTHORS
Written by
.An Jonas ‘FireFly’ Höglund.