8

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
  • 285
  • 4
  • 11
  • 6
    @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. – Nicryc Jan 16 '20 at 03:07
  • 1
    It's a pity hexdump can't do reverse like xxd does – Osqui Feb 19 '20 at 11:44
  • @Nicryc make that an answer! – Jacktose Nov 15 '22 at 21:10

2 Answers2

8

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.

xkcd: Standards

Enjoy; these are amazing times!

A selection for further reading:

Murphy
  • 2,609
  • 1
  • 13
  • 21
1

od provides more formatting options, such as -t d1, which displays signed bytes.

bu5hman
  • 4,663
  • 2
  • 14
  • 29
albator
  • 11
  • 1