Hexdump

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Hexdump is a command-line tool used to show the raw bytes of a file in various ways including hexadecimal, available on Linux, FreeBDS, OS X, and other platforms. Hexdump is not part of traditional Unix systems or GNU commands.

Options[edit]

Command-line options aka switches of hexdump:

  • -b: One-byte octal display.
  • -c: One-byte character display.
  • -C: Canonical hex+ASCII display.
  • -d: Two-byte decimal display.
  • -e format_string: Format the data as specified in the format string.
  • -f format_file: Use newline-separated format strings from the file.
  • -n length: Process only length bytes of input.
  • -o: Two-byte octal display.
  • -s offset: Ignore offset bytes from the beginning of the input.
  • -v: Use unabbreviated display rather than displaying some sequences merely as *.
  • -x: Two-byte hexadecimal display.

Examples[edit]

Examples of hexdump use:

  • hexdump -v -e '"" 1/1 "%02X" " "' myfile
    • Shows the bytes in hexadecimal using capitalized letters, each byte separated by a space. The first "" specifies and empty prefix, while the last " " specifies a single-space suffix.

Versions[edit]

A different version of hexdump for MS Windows is available from GnuWin32 project.

External links[edit]