What is the difference between the od, hd, hexdump and xxd commands?
Solution 1
Unix, of which Linux is just one flavour, has a long and rich history. It has not been developed by a single company or group, nor following a master plan, and has evolved by adaption to many niches. You can find many examples where multiple tools cover similar or the same functionality. They have been implemented by different people at different times for similar purposes; check their manpages for hints.
Thanks to the rise of Open Source in general, and the possibilities of the information age, we can enjoy the benefit of many of these tools being generally available to our use. The attempt to merge them into one will result in one more being available.
Enjoy; these are amazing times!
A selection for further reading:
- https://en.wikipedia.org/wiki/History_of_Unix
- http://www.catb.org/esr/writings/taoup/html/historychapter.html
- http://www.catb.org/esr/writings/cathedral-bazaar/
- https://www.levenez.com/unix/
Solution 2
od
provides more formatting options, such as -t d1
, which displays signed bytes.
Related videos on Youtube
![Nicryc](https://i.stack.imgur.com/elKMY.jpg?s=256&g=1)
Nicryc
Updated on September 18, 2022Comments
-
Nicryc almost 2 years
What is the difference between the od, hd, hexdump and xxd commands ?
They are all commands for dumping files and they can all dump it in various formats such as hexadecimal, octal or binary. Why creating different programs ?
-
Nicryc over 4 years@jsotola
od
- dump files in octal and other formats.hexdump
- ascii, decimal, hexadecimal, octal dump.hd
- it's strange it doesn't seem to exist on the Linux man pages but I can find it on some website that list those pages and it seems to be an alias for hexdump.xxd
- make a hexdump or do the reverse, in comparison to the three others, it can do a reverse. They all have some specific features but overall they do the same main job. We can even have equivalents commands from one to another. I was just wondering why not improve a single one instead of creating multiple commands. -
Osqui over 4 yearsIt's a pity hexdump can't do reverse like xxd does
-