The Hex Dump utility is a console-based program used to display the contents of a binary file in hexadecimal format. This program can also be used to edit a binary file using any text editor.
To use the utility, enter the name of the program followed by the name of the binary file. NOTE: If you do not specify an output file name, the program will write to the console.
hexdump -p simple.gxd (Write to console) hexdump simple.gxd simple.txt (Write to simple.txt file) hexdump simple.gxd > simple.txt (Redirect to file) hexdump simple.gxd >> simple.txt (Append to file)
You can pass one of several switches to the program from the command line. For a list of switches, execute the program with no arguments or with a "-?" argument: "hexdump" or "hexdump -?"
Hexadecimal file dump program version 4000.101 Usage: hexdump [switches] infile outfile (optional) Switches: -? = Display this help message. -c = Display a 32-bit CRC checksum value. -C = Display a 16-bit CRC checksum value. -d = Display in decimal mode (Default is HEX). -p# = Prompting after displaying # line: -p10 -r = Rebuild binary file from hex dump text file. Only works for files created in hex mode. -s = Strip comments from output. -x = Convert 32-bit HEX number to DEC: -Xfefe -X = Convert signed 32-bit HEX number to DEC. -B = Convert 32-bit HEX number to binary: -Bfefe -D = Convert DEC number to HEX: -D23
The "-c" switch is used to display a 32-bit checksum for a file.
The "-C" switch is used to display a 16-bit checksum for a file.
The "-d" switch is used to display the binary file in decimal format. The default is hexadecimal format. NOTE: A text file created in decimal format cannot be used to perform a hex edit.
The "-p#" switch is used to enable prompting when dumping a binary file to the console. You must specify the number of lines to scroll when dumping a file. If the "-p#" option is not specified, the entire file will be dumped.
The "-s" switch is used to strip the comments from the hex dump output.
The "-x", "-X", "-B", and "-D" switches are used to convert values between different number systems.
The "-r" switch is used to build a binary file from a hex dump text file.
All hex dump text files have 16 bytes per line. A tab, a semicolon, and then any printable characters follow the end of the byte string. All non-printable characters will be represented by a dot. The rebuild function will truncate any characters following the byte string before building the binary file. A single tab or a semicolon always represents the end of the byte string. Each byte in the byte string is represented by two characters and must be separated by a single space, with a maximum of 255 bytes per string. The rebuild function parses the byte string and writes each byte to the specified output file. If no output file name is specified, the rebuild function will create a file named "outfile.bin".
In order to perform a hex edit on a binary file you must first create a hex dump text file:
hexdump simple.gxd simple.txt
After creating the hex dump text file, use any text editor to edit the file:
edit simple.txt notepad simple.txt emacs simple.txt vi simple.txt 00 00 00 00 64 00 00 00 28 00 00 00 28 00 00 00 ; ....d...(...(... 47 58 44 42 41 53 45 43 A0 0F 00 00 00 00 00 00 ; GXDBASEC........ 00 00 00 00 00 00 00 00 FE FE 00 00 3C 00 00 00 ; ............<... 4E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ; N............... 00 00 00 00 4D 6F 75 73 65 00 00 00 00 00 00 00 ; ....Mouse....... 00 00 00 00 44 00 00 00 40 9F 40 67 6C 8B 43 96 ; ....D...@.@gl.C. 00 00 00 00 ; ....
After editing the file, rebuild the binary file with the "-r" option:
hexdump -r simple.txt newfile.gxd
End Of Document