Unix History: Why does hexdump default to word alignment?

Unix History: Why does hexdump default to word alignment?

Elazar Leibovich elazarl at gmail.com
Thu Dec 1 09:16:54 IST 2011


The default behaviour of hexdump is to align data word-wide. For instance

    printf '\xFF\xFF\x01' | hexdump
    0000000 ffff 0001
    0000003

This makes little sense to me. In C, structs are not necessarily aligned to
words, and it doesn't seems useful to view about any data format for which
you're sure everything is word-aligned. The "hexdump -C" behaviour makes
much more sense in the general case.

    printf '\xFA\xFB\x01' | hexdump -C
    00000000  fa fb 01                                          |...|
    00000003

No confusion.

I'm sure there was a reason for that, but I can't think about one.

(I apologize for the slightly off-topic post)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20111201/f5d2eb03/attachment.html>


More information about the Linux-il mailing list