LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-18-2012, 02:44 AM   #1
ybpark81
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Rep: Reputation: Disabled
hexdump / xxd


hi...

Is there anyone who can explain about this two linux commands?

I tried to find something over internet but nothing.

I found some pages where explain that this two commands is for debugging. But I dont understand how to use?

Can you explain me please?

Thanks.
 
Old 02-18-2012, 07:09 AM   #2
Heraton
Member
 
Registered: Apr 2011
Location: Germany
Distribution: Mint 10, openSuSE
Posts: 58

Rep: Reputation: 3
Hello!

This two programs are in fact pretty useful when you need to analyse raw data. Don't get me wrong, if the according man pages didn't make sense to you, this programs are most likely not for you, as they are quite self explaining. Anyway, here is the gist:

A byte is an 8 bit dual number. That means it can take 256 different values. Two bit hexadecimal numbers can take 256 vales too. And because the common programmer strongly preferes to work with values like "0F:11:A3" instead of "00001111 00010001 10100011" (which is, by the way, quite the same information, just once hex and once binary) we tend to convert raw data into "readable" hexadecimal notation. That is what this two tool are made for.

Code:
xxd inputfile outputfile
This will read the file "inputfile" byte by byte, convert the binary data to its hexadecimal representation and will then print it in ascii into the file "outputfile". Thus you can use xxd to make a raw data file "readable hex"...

Code:
xxd -r inputfile outputfile
This will do the reverse. It reads the file "inputfile", which is supposed to contain hex data in plain ascii, and writes a file that contains the according raw data.

Code:
hexdump inputfile
This will print the hex representation of the data in "inputfile" to the console. Quite similar to
Code:
xxd inputfile
which does almost the same...

Note that there is some "help" generated when transforming from raw data to hex. Both xxd and hexdump will print a first column with a hex value indicating the byte offset of the following row. The second column is the hex data. Both xxd and hexdump will group two bytes each, separating the groups by spaces. That is for readability issues only. The third column is only generated by xxd and shows, which 7bit ascii characters would match that raw data. This is very useful if you try to analyse a program or protocol and you are looking for string constants.


Whew, hope that made any sense to you.

Regards, Heraton
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why are 0 's escaped in hexdump? dman777 Linux - General 1 05-11-2011 02:03 AM
hexdump vs od sulekha Linux - General 1 01-12-2009 04:35 PM
tablet stopped working - no xxd output tomekp Linux - Hardware 0 07-05-2006 09:21 AM
Can't find xxd for fedora core 5 Butterbroetchen Fedora 6 06-28-2006 08:20 AM
xxd missing? everbloom Linux - Newbie 3 05-14-2005 01:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:15 AM.

Main Menu
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration