This page describes, in Unix manual page style, xd, a utility which dumps files in hexadecimal, decimal, or octal, with file addresses shown in any of those formats. xd can read files in any of the formats it writes, recreating binary files, including modifications made by editing the dump with any text editor. In addition, xd can transform a binary file into a C data declaration which permits embedding its contents into a program. xd is available as C source code compatible with most Unix systems.
xd – extended dump and load utility
xd [ −aaddrfmt −c −dlabel −l −ndatafmt −s ] [ infile [ outfile ] ]
xd dumps files in hexadecimal, decimal, or octal, optionally with ISO characters side by side. File addresses can likewise be displayed in hex, decimal, or octal notation.
xd can read dump files in the same formats it writes and create binary files from the data therein. This allows you to dump a binary file with xd, edit it with your favourite text editor, then make a new binary file containing whatever changes you've made. When creating a binary file, xd normally assumes you've only modified data in place (neither expanding nor contracting the file) and verifies file addresses to guarantee this. However, a "stream" option is available which ignores file addresses so you're free to insert and delete bytes at will. xd thus turns your existing text editor into a binary file editor without requiring you to learn any new commands.
Finally, xd can read a binary file and emit a C language data declaration which contains the data from the file. This is handy when you wish to embed binary data within C programs.
If no infile is specified, xd obtains its input from standard input; if no outfile is given, output is sent to standard output. The input and output are processed in a strictly serial manner regardless of options; consequently xd may be used in pipelines without restrictions.
Input error checking in load mode might be improved. Note that each byte in load mode must be specified as a number in the same format selected by the −n option when the file was dumped, separated by white space, and that the −a and −n options must be set the same when loading a file as when it was dumped.
cc(1), od(1), iso_8859_1(7)
The release archive contains source code, a Makefile for building the program, and documentation in manual page and HTML form.
This software is in the public domain. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, without any conditions or restrictions. This software is provided “as is” without express or implied warranty.