Od is a Unix command-line tool used to show the raw bytes of a file in various ways including hexadecimal and octal, available on many platforms.

Options

Command-line options aka switches of od:

  • -b: Show bytes in octal.
  • -c: Show the ASCII characters of bytes.
  • -d: Show words in decimal.
  • -o: Show words in octal.
  • -x: Show words in hex.

Command-line options aka switches of GNU od, beyond the bare-bones od:

  • -t: Display the bytes as per format string.
  • And more.

Links:

Examples

Examples of od use:

  • od -x myfile
    • Outputs hex, interpreting per two bytes.
  • od -tx1 myfile
    • In GNU od, outputs hex, interpreting per one byte. Depending on the endianness of the system, the sequence on the byte level need not be the same as with od -x.
  • od -tx1z myfile
    • In GNU od, as above but outputting ASCII to the right per "z".
  • od -txz myfile
    • In GNU od, as above, but interpreting per multiple bytes.
  • od -tx8z myfile
    • In GNU od, as above but interpreting per 8 bytes.
  • od -tx7z myfile
    • In GNU od, may return with an error, since 7 is not a byte count supported.
  • od -tx16z myfile
    • In GNU od, may return with an error, since 16 is not a byte count supported.

Versions

A version of GNU od for MS Windows is available from GnuWin32 project, as well as from Cygwin.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.