What is the difference between the od, hd, hexdump and xxd commands?

6,306

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.

xkcd: Standards

Enjoy; these are amazing times!

A selection for further reading:

Solution 2

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

Share:
6,306

Related videos on Youtube

Nicryc
Author by

Nicryc

Updated on September 18, 2022

Comments

  • Nicryc
    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
      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
      Osqui over 4 years
      It's a pity hexdump can't do reverse like xxd does