version 2 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
XXD |
|
|
2 |
!!!XXD |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
OPTIONS |
|
|
7 |
CAVEATS |
|
|
8 |
EXAMPLES |
|
|
9 |
RETURN VALUES |
|
|
10 |
SEE ALSO |
|
|
11 |
WARNINGS |
|
|
12 |
VERSION |
|
|
13 |
AUTHOR |
|
|
14 |
---- |
|
|
15 |
!!NAME |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
''xxd'' - make a hexdump or do the reverse. |
|
|
19 |
!!SYNOPSIS |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
__xxd__ -h[[elp]__ |
|
|
23 |
xxd__ [[options] [[infile [[outfile]]__ |
|
|
24 |
xxd__ -r[[evert] [[options] [[infile [[outfile]] |
|
|
25 |
!!DESCRIPTION |
|
|
26 |
|
|
|
27 |
|
|
|
28 |
''xxd'' creates a hex dump of a given file or standard |
|
|
29 |
input. It can also convert a hex dump back to its original |
|
|
30 |
binary form. Like __uuencode(1)__ and __uudecode(1)__ |
|
|
31 |
it allows the transmission of binary data in a `mail-safe' |
|
|
32 |
ASCII representation, but has the advantage of decoding to |
|
|
33 |
standard output. Moreover, it can be used to perform binary |
|
|
34 |
file patching. |
|
|
35 |
!!OPTIONS |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
If no ''infile'' is given, standard input is read. If |
|
|
39 |
''infile'' is specified as a __-__' character, then |
|
|
40 |
input is taken from standard input. If no ''outfile'' is |
|
|
41 |
given (or a __-__' character is in its place), results |
|
|
42 |
are sent to standard output. |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
Note that a |
|
|
46 |
-c8__, __-c 8__, __-c 010__ and |
|
|
47 |
__-cols 8__ are all equivalent. |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
''-a'' | ''-autoskip'' |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
toggle autoskip: A single '*' replaces nul-lines. Default |
|
|
54 |
off. |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
''-b'' | ''-bits'' |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
Switch to bits (binary digits) dump, rather than hexdump. |
|
|
61 |
This option writes octets as eight digits |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
''-c cols'' | ''-cols cols'' |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
''-c cols'' | ''-cols cols'' format |
|
|
68 |
''cols'' |
|
|
69 |
'' |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
''-E'' | ''-EBCDIC'' |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
Change the character encoding in the righthand column from |
|
|
76 |
ASCII to EBCDIC. This does not change the hexadecimal |
|
|
77 |
representation. The option is meaningless in combinations |
|
|
78 |
with -r, -p or -i. |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
''-g bytes'' | ''-groupsize bytes'' |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
seperate the output of every bytes'' |
|
|
85 |
''-g 0'' to suppress grouping. |
|
|
86 |
''Bytes''''2'' in normal mode and |
|
|
87 |
''1'' in bits mode. Grouping does not apply to postscript |
|
|
88 |
or include style. |
|
|
89 |
|
|
|
90 |
|
|
|
91 |
''-h'' | ''-help'' |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
print a summary of available commands and exit. No hex |
|
|
95 |
dumping is performed. |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
''-i'' | ''-include'' |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
output in C include file style. A complete static array |
|
|
102 |
definition is written (named after the input file), unless |
|
|
103 |
xxd reads from stdin. |
|
|
104 |
|
|
|
105 |
|
|
|
106 |
''-l len'' | ''-len len'' |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
stop after writing len'''' |
|
|
110 |
|
|
|
111 |
|
|
|
112 |
''-p'' | ''-ps'' | ''-postscript'' | |
|
|
113 |
''-plain'' |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
output in postscript continuous hexdump style. Also known as |
|
|
117 |
plain hexdump style. |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
''-r'' | ''-revert'' |
|
|
121 |
|
|
|
122 |
|
|
|
123 |
reverse operation: convert (or patch) hexdump into binary. |
|
|
124 |
If not writing to stdout, xxd writes into its output file |
|
|
125 |
without truncating it. Use the combination ''-r -p'' to |
|
|
126 |
read plain hexadecimal dumps without line number information |
|
|
127 |
and without a particular column layout. Additional |
|
|
128 |
Whitespace and line-breaks are allowed |
|
|
129 |
anywhere. |
|
|
130 |
|
|
|
131 |
|
|
|
132 |
''-seek offset'' |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
When used after ''-r'' : revert with |
|
|
136 |
''offset'' |
|
|
137 |
'' |
|
|
138 |
|
|
|
139 |
|
|
|
140 |
''-s [[+][[-]seek'' |
|
|
141 |
|
|
|
142 |
|
|
|
143 |
start at seek'' |
|
|
144 |
''+'' indicates that the seek is relative to the |
|
|
145 |
current stdin file position (meaningless when not reading |
|
|
146 |
from stdin). ''-'' indicates that the seek should be that |
|
|
147 |
many characters from the end of the input (or if combined |
|
|
148 |
with ''+'' : before the current stdin file position). |
|
|
149 |
Without -s option, xxd starts at the current file |
|
|
150 |
position. |
|
|
151 |
|
|
|
152 |
|
|
|
153 |
''-u'' |
|
|
154 |
|
|
|
155 |
|
|
|
156 |
use upper case hex letters. Default is lower |
|
|
157 |
case. |
|
|
158 |
|
|
|
159 |
|
|
|
160 |
''-v'' | ''-version'' |
|
|
161 |
|
|
|
162 |
|
|
|
163 |
show version string. |
|
|
164 |
!!CAVEATS |
|
|
165 |
|
|
|
166 |
|
|
|
167 |
''xxd -r'' has some builtin magic while evaluating line |
|
|
168 |
number information. If the ouput file is seekable, then the |
|
|
169 |
linenumbers at the start of each hexdump line may be out of |
|
|
170 |
order, lines may be missing, or overlapping. In these cases |
|
|
171 |
xxd will lseek(2) to the next position. If the output file |
|
|
172 |
is not seekable, only gaps are allowed, which will be filled |
|
|
173 |
by null-bytes. |
|
|
174 |
|
|
|
175 |
|
|
|
176 |
''xxd -r'' never generates parse errors. Garbage is |
|
|
177 |
silently skipped. |
|
|
178 |
|
|
|
179 |
|
|
|
180 |
When editing hexdumps, please note that ''xxd -r'' skips |
|
|
181 |
everything on the input line after reading enough columns of |
|
|
182 |
hexadecimal data (see option -c). This also means, that |
|
|
183 |
changes to the printable ascii (or ebcdic) columns are |
|
|
184 |
always ignored. Reverting a plain (or postscript) style |
|
|
185 |
hexdump with xxd -r -p does not depend on the correct number |
|
|
186 |
of columns. Here an thing that looks like a pair of |
|
|
187 |
hex-digits is interpreted. |
|
|
188 |
|
|
|
189 |
|
|
|
190 |
Note the difference between'' |
|
|
191 |
% xxd -i file'' |
|
|
192 |
and'' |
|
|
193 |
% xxd -i |
|
|
194 |
|
|
|
195 |
|
|
|
196 |
''xxd -s +seek'' may be different from ''xxd -s seek'' |
|
|
197 |
, as lseek(2) is used to |
|
|
198 |
'' |
|
|
199 |
|
|
|
200 |
|
|
|
201 |
Rewind stdin before reading; needed because the `cat' has |
|
|
202 |
already read to the end of stdin.'' |
|
|
203 |
% sh -c 'cat |
|
|
204 |
|
|
|
205 |
|
|
|
206 |
Hexdump from file position 0x480 (=1024+128) onwards. The |
|
|
207 |
`+' sign means |
|
|
208 |
% sh -c 'dd of=plain_snippet bs=1k count=1; xxd -s +128 |
|
|
209 |
|
|
|
210 |
|
|
|
211 |
Hexdump from file position 0x100 ( = 1024-768) on.'' |
|
|
212 |
% sh -c 'dd of=plain_snippet bs=1k count=1; xxd -s +-768 |
|
|
213 |
|
|
|
214 |
|
|
|
215 |
However, this is a rare situation and the use of `+' is |
|
|
216 |
rarely needed. the author prefers to monitor the effect of |
|
|
217 |
xxd with strace(1) or truss(1), whenever -s is |
|
|
218 |
used. |
|
|
219 |
!!EXAMPLES |
|
|
220 |
|
|
|
221 |
|
|
|
222 |
Print everything but the first three lines (hex 0x30 bytes) |
|
|
223 |
of __file__'' |
|
|
224 |
% xxd -s 0x30 file'' |
|
|
225 |
|
|
|
226 |
|
|
|
227 |
Print 3 lines (hex 0x30 bytes) from the end of |
|
|
228 |
__file__'' |
|
|
229 |
% xxd -s -0x30 file'' |
|
|
230 |
|
|
|
231 |
|
|
|
232 |
Print 120 bytes as continuous hexdump with 40 octets per |
|
|
233 |
line.'' |
|
|
234 |
% xxd -l 120 -ps -c 20 xxd.1'' |
|
|
235 |
2e544820585844203120224d616e75616c207061 |
|
|
236 |
676520666f7220787864220a2e5c220a2e5c2220 |
|
|
237 |
32317374204d617920313939360a2e5c22204d61 |
|
|
238 |
6e207061676520617574686f723a0a2e5c222020 |
|
|
239 |
2020546f6e79204e7567656e74203c746f6e7940 |
|
|
240 |
7363746e7567656e2e7070702e67752e6564752e |
|
|
241 |
|
|
|
242 |
|
|
|
243 |
Hexdump the first 120 bytes of this man page with 12 octets |
|
|
244 |
per line.'' |
|
|
245 |
% xxd -l 120 -c 12 xxd.1'' |
|
|
246 |
0000000: 2e54 4820 5858 4420 3120 224d .TH XXD 1 |
|
|
247 |
000000c: 616e 7561 6c20 7061 6765 2066 anual page f |
|
|
248 |
0000018: 6f72 2078 7864 220a 2e5c 220a or |
|
|
249 |
xxd |
|
|
250 |
0000024: 2e5c 2220 3231 7374 204d 6179 . |
|
|
251 |
0000030: 2031 3939 360a 2e5c 2220 4d61 1996.. |
|
|
252 |
000003c: 6e20 7061 6765 2061 7574 686f n page autho |
|
|
253 |
0000048: 723a 0a2e 5c22 2020 2020 546f r:.. |
|
|
254 |
0000054: 6e79 204e 7567 656e 7420 3c74 ny Nugent |
|
|
255 |
0000060: 6f6e 7940 7363 746e 7567 656e ony@sctnugen |
|
|
256 |
000006c: 2e70 7070 2e67 752e 6564 752e |
|
|
257 |
.ppp.gu.edu. |
|
|
258 |
|
|
|
259 |
|
|
|
260 |
Display just the date from the file xxd.1'' |
|
|
261 |
% xxd -s 0x28 -l 12 -c 12 xxd.1'' |
|
|
262 |
0000028: 3231 7374 204d 6179 2031 3939 21st May |
|
|
263 |
199 |
|
|
264 |
|
|
|
265 |
|
|
|
266 |
Copy __input_file__ to __output_file__ and prepend 100 |
|
|
267 |
bytes of value 0x00.'' |
|
|
268 |
% xxd input_file | xxd -r -s 100 |
|
|
269 |
|
|
|
270 |
|
|
|
271 |
Patch the date in the file xxd.1'' |
|
|
272 |
% echo '0000029: 3574 68' | xxd -r - xxd.1 |
|
|
273 |
% xxd -s 0x28 -l 12 -c 12 xxd.1'' |
|
|
274 |
0000028: 3235 7468 204d 6179 2031 3939 25th May |
|
|
275 |
199 |
|
|
276 |
|
|
|
277 |
|
|
|
278 |
Create a 65537 byte file with all bytes 0x00, except for the |
|
|
279 |
last one which is 'A' (hex 0x41).'' |
|
|
280 |
% echo '010000: 41' | xxd -r |
|
|
281 |
|
|
|
282 |
|
|
|
283 |
Hexdump this file with autoskip.'' |
|
|
284 |
% xxd -a -c 12 file'' |
|
|
285 |
0000000: 0000 0000 0000 0000 0000 0000 ............ |
|
|
286 |
* |
|
|
287 |
000fffc: 0000 0000 40 ....A |
|
|
288 |
|
|
|
289 |
|
|
|
290 |
Create a 1 byte file containing a single 'A' character. The |
|
|
291 |
number after '-r -s' adds to the linenumbers found in the |
|
|
292 |
file; in effect, the leading bytes are suppressed.'' |
|
|
293 |
% echo '010000: 41' | xxd -r -s -0x10000 |
|
|
294 |
|
|
|
295 |
|
|
|
296 |
Use xxd as a filter within an editor such as vim(1) |
|
|
297 |
to hexdump a region marked between `a' and `z'.'' |
|
|
298 |
:'a,'z!xxd'' |
|
|
299 |
|
|
|
300 |
|
|
|
301 |
Use xxd as a filter within an editor such as vim(1) |
|
|
302 |
to recover a binary hexdump marked between `a' and |
|
|
303 |
`z'.'' |
|
|
304 |
:'a,'z!xxd -r'' |
|
|
305 |
|
|
|
306 |
|
|
|
307 |
Use xxd as a filter within an editor such as vim(1) |
|
|
308 |
to recover one line of a hexdump. Move the cursor over the |
|
|
309 |
line and type:'' |
|
|
310 |
!!xxd -r'' |
|
|
311 |
|
|
|
312 |
|
|
|
313 |
Read single characters from a serial line'' |
|
|
314 |
% xxd -c1 |
|
|
315 |
% stty |
|
|
316 |
% echo -n foo |
|
|
317 |
!!RETURN VALUES |
|
|
318 |
|
|
|
319 |
|
|
|
320 |
The following error values are returned: |
|
|
321 |
|
|
|
322 |
|
|
|
323 |
0 |
|
|
324 |
|
|
|
325 |
|
|
|
326 |
no errors encountered. |
|
|
327 |
|
|
|
328 |
|
|
|
329 |
-1 |
|
|
330 |
|
|
|
331 |
|
|
|
332 |
operation not supported ( ''xxd -r -i'' still |
|
|
333 |
impossible). |
|
|
334 |
|
|
|
335 |
|
|
|
336 |
1 |
|
|
337 |
|
|
|
338 |
|
|
|
339 |
error while parsing options. |
|
|
340 |
|
|
|
341 |
|
|
|
342 |
2 |
|
|
343 |
|
|
|
344 |
|
|
|
345 |
problems with input file. |
|
|
346 |
|
|
|
347 |
|
|
|
348 |
3 |
|
|
349 |
|
|
|
350 |
|
|
|
351 |
problems with output file. |
|
|
352 |
|
|
|
353 |
|
|
|
354 |
4,5 |
|
|
355 |
|
|
|
356 |
|
|
|
357 |
desired seek position is unreachable. |
|
|
358 |
!!SEE ALSO |
|
|
359 |
|
|
|
360 |
|
|
|
361 |
uuencode(1), uudecode(1), patch(1) |
|
|
362 |
!!WARNINGS |
|
|
363 |
|
|
|
364 |
|
|
|
365 |
The tools weirdness matches its creators brain. Use entirely |
|
|
366 |
at your own risk. Copy files. Trace it. Become a |
|
|
367 |
wizard. |
|
|
368 |
!!VERSION |
|
|
369 |
|
|
|
370 |
|
|
|
371 |
This manual page documents xxd version 1.7 |
|
|
372 |
!!AUTHOR |
|
|
373 |
|
|
|
374 |
|
|
|
375 |
(c) 1990-1997 by Juergen Weigert |
|
|
376 |
|
|
|
377 |
|
|
|
378 |
Distribute freely and credit me, |
|
|
379 |
make money and share with me, |
|
|
380 |
lose money and don't ask me. |
|
|
381 |
|
|
|
382 |
|
|
|
383 |
Manual page started by Tony Nugent |
|
|
384 |
Small changes by Bram Moolenaar. Edited by Juergen |
|
|
385 |
Weigert. |
|
|
386 |
---- |