Does hexdump respect the endianness of its system?
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
add a comment |
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
add a comment |
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
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
utilities bsd hexdump
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
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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.
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" isuint16_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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 14 '12 at 23:55
GillesGilles
536k12810821600
536k12810821600
add a comment |
add a comment |
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.
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" isuint16_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
add a comment |
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.
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" isuint16_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
add a comment |
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.
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.
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" isuint16_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
add a comment |
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" isuint16_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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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