Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using hexdump, printing these characters in the "canonical" format gives the output that I expect, while the default format throws me off.

$ echo " " |hexdump                  # Reversed?
0000000 0a20

$ echo -n " " |hexdump               # Ok, fair enough.
0000000 0020

$ echo  " " |hexdump -C              # Canonical
00000000  20 0a                      | .|

With a different string, such as "123", the output is even more confusing:

$ echo  "123" |hexdump
0000000 3231 0a33

The output here does not seem "reversed", but rather it is shuffled. What (briefly) is going on here?

share|improve this question
up vote 0 down vote accepted

The default format is 16-bit little-endian unsigned ints.

The manual page of hexdump explains the default format as well:

 -x  Two-byte hexadecimal display.  Display the input offset in hexadecimal, 
     followed  by eight  space-separated, four-column, zero-filled, two-byte 
     quantities of input data, in hexadecimal, per line.


  If  no format strings are specified, the default display is equivalent to 
  specifying the -x option.
share|improve this answer
Perhaps not part of a brief answer, but do you know why that is the default format? I mean to ask, what is it convenient for? – Ярослав Рахматуллин Dec 6 '12 at 3:58
It's left over from when Unix was invented on 16-bit minicomputers in the 70s. – Nicole Hamilton Dec 6 '12 at 5:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.