4

Is there any way to change the default line length for the od and hexdump commands? Can't see anything apropriate in the man pages.

3

od has the --width=N argument, which you can use to choose how many bytes per line, perhaps that's what you're looking for? hexdump has a -e FORMATSTRING which has promise, but I've never played too much with it.

| improve this answer | |
  • hey thanks for the tip about width in od, my man pages didn't have that! – newenglander May 4 '12 at 22:05
  • 1
    @newenglander as mentioned under SEE ALSO you should also check info coreutils 'od invocation'. – Thor May 4 '12 at 22:09
  • With anything GNU, it's always a good idea to check the info page. It has much more information. – jsbillings May 4 '12 at 22:09
  • Thanks for the extra tip, my SEE ALSO only had hexdump(1), strings(1). – newenglander May 4 '12 at 22:15
  • Calling info coreutils 'od invocation' on my systems (Mac OS X, FreeBSD) gives me the message No menu item 'coreutils' in node '(dir)Top'. But I did try it on Linux and it was indeed more helpful (but then again so was the man page on that system). – newenglander May 6 '12 at 14:37
7

I know this is an old question, but for completeness, here is an example hexdump command that prints 8 bytes per line:

hexdump -e '8/1 " %02X" "\n"' <file>

More information about hexdump format strings can be found at these links:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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