LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Blogs > neonsignal
User Name
Password

Notices



Rate this Entry

dumping a file in hexadecimal

Posted 05-28-2011 at 05: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 266 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 01:54 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration