LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > neonsignal
User Name
Password

Notices


Rate this Entry

dumping a file in hexadecimal

Posted 05-28-2011 at 04:03 AM by neonsignal

There are several ways to dump a binary as hex values. The following examples generate single byte hex values with no addresses (which can be useful when generating array initialization code).

There is the program od:
Code:
od -A n -t x1 file.bin
The '-A n' turns off the addresses, and the '-t x1' sets it to single byte hex formatting.

There is also the program hexdump, which is more flexible in the formatting of the results:
Code:
hexdump file.bin -e '"" 128/1 "%02X " "\n"'
The '128/1' specifies 128 bytes per line, and the '%02X' is the format string.
Posted in Uncategorized
Views 578 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 01:19 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration