Why does newline come before space in the output of hexdump?

Posted by ??????? ??????????? on Super User See other posts from Super User or by ??????? ???????????
Published on 2012-12-06T02:55:11Z Indexed on 2012/12/06 5:09 UTC
Read the original article Hit count: 437

Filed under:
|
|

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
0000002

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

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

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

$ echo  "123" |hexdump
0000000 3231 0a33                    
0000004

The output here does not seem "reversed", but rather shuffled. Would anyone care to explain (briefly) what is going on here?

© Super User or respective owner

Related posts about format

Related posts about hexdump