Does hexdump respect the endianness of its system?












18















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





























    18















    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



























      18












      18








      18


      5






      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
















      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?







      utilities bsd hexdump






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 27 '14 at 17:10









      jw013

      36.3k6100125




      36.3k6100125










      asked Nov 14 '12 at 23:48









      Cory KleinCory Klein

      5,422215983




      5,422215983






















          2 Answers
          2






          active

          oldest

          votes


















          24














          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































            5














            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
            line.


            ...



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


            Your output is 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





















            • 3





              Is it just me, or does the man page not mention anywhere that it is treating the "two-byte quantities" as integers? I thought I was taking crazy pills...

              – slashingweapon
              Jun 14 '17 at 21:41











            • @slashingweapon "two-byte quantity of input data" is uint16_t integer.

              – Ruslan
              May 8 '18 at 7:53













            • "Two bytes" is not the same as uint16_t on a little-endian system.

              – slashingweapon
              May 10 '18 at 16:43











            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f55770%2fdoes-hexdump-respect-the-endianness-of-its-system%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            24














            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




























              24














              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


























                24












                24








                24







                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













                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












                share|improve this answer



                share|improve this answer










                answered Nov 14 '12 at 23:55









                GillesGilles

                536k12810821600




                536k12810821600

























                    5














                    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
                    line.


                    ...



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


                    Your output is 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





















                    • 3





                      Is it just me, or does the man page not mention anywhere that it is treating the "two-byte quantities" as integers? I thought I was taking crazy pills...

                      – slashingweapon
                      Jun 14 '17 at 21:41











                    • @slashingweapon "two-byte quantity of input data" is uint16_t integer.

                      – Ruslan
                      May 8 '18 at 7:53













                    • "Two bytes" is not the same as uint16_t on a little-endian system.

                      – slashingweapon
                      May 10 '18 at 16:43
















                    5














                    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
                    line.


                    ...



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


                    Your output is 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





















                    • 3





                      Is it just me, or does the man page not mention anywhere that it is treating the "two-byte quantities" as integers? I thought I was taking crazy pills...

                      – slashingweapon
                      Jun 14 '17 at 21:41











                    • @slashingweapon "two-byte quantity of input data" is uint16_t integer.

                      – Ruslan
                      May 8 '18 at 7:53













                    • "Two bytes" is not the same as uint16_t on a little-endian system.

                      – slashingweapon
                      May 10 '18 at 16:43














                    5












                    5








                    5







                    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
                    line.


                    ...



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


                    Your output is 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















                    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
                    line.


                    ...



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


                    Your output is 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














                    share|improve this answer



                    share|improve this answer








                    edited Jan 30 at 22:46









                    Cory Klein

                    5,422215983




                    5,422215983










                    answered Nov 14 '12 at 23:54









                    Dennis KaarsemakerDennis Kaarsemaker

                    6,89812326




                    6,89812326








                    • 3





                      Is it just me, or does the man page not mention anywhere that it is treating the "two-byte quantities" as integers? I thought I was taking crazy pills...

                      – slashingweapon
                      Jun 14 '17 at 21:41











                    • @slashingweapon "two-byte quantity of input data" is uint16_t integer.

                      – Ruslan
                      May 8 '18 at 7:53













                    • "Two bytes" is not the same as uint16_t on a little-endian system.

                      – slashingweapon
                      May 10 '18 at 16:43














                    • 3





                      Is it just me, or does the man page not mention anywhere that it is treating the "two-byte quantities" as integers? I thought I was taking crazy pills...

                      – slashingweapon
                      Jun 14 '17 at 21:41











                    • @slashingweapon "two-byte quantity of input data" is uint16_t integer.

                      – Ruslan
                      May 8 '18 at 7:53













                    • "Two bytes" is not the same as uint16_t on a little-endian system.

                      – slashingweapon
                      May 10 '18 at 16:43








                    3




                    3





                    Is it just me, or does the man page not mention anywhere that it is treating the "two-byte quantities" as integers? I thought I was taking crazy pills...

                    – slashingweapon
                    Jun 14 '17 at 21:41





                    Is it just me, or does the man page not mention anywhere that it is treating the "two-byte quantities" as integers? I thought I was taking crazy pills...

                    – slashingweapon
                    Jun 14 '17 at 21:41













                    @slashingweapon "two-byte quantity of input data" is uint16_t integer.

                    – Ruslan
                    May 8 '18 at 7:53







                    @slashingweapon "two-byte quantity of input data" is uint16_t integer.

                    – Ruslan
                    May 8 '18 at 7:53















                    "Two bytes" is not the same as uint16_t on a little-endian system.

                    – slashingweapon
                    May 10 '18 at 16:43





                    "Two bytes" is not the same as uint16_t on a little-endian system.

                    – slashingweapon
                    May 10 '18 at 16:43


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f55770%2fdoes-hexdump-respect-the-endianness-of-its-system%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

                    is 'sed' thread safe

                    How to make a Squid Proxy server?