Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

On my machine I get the following output when I run these commands:

$ echo foos > myfile
$ hexdump myfile
6f66 736f 000a

The output from hexdump is little-endian. Does this mean that my machine is little-endian, or does hexdump always use little-endian format?

share|improve this question
up vote 12 down vote accepted

Yes, the traditional BSD hexdump utility always uses the platform's endianness. Use hexdump -C (or od -t x1) to get more sensible byte-by-byte output.

share|improve this answer

From the manpage:

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


 If no format strings are specified, the default display is equivalent to
 specifying the -x option.

Your output is actually little-endian (least significant byte first), which is also the endianness of the x86 and x86_64 architectures, which you are probably using.

share|improve this answer

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.