← 返回命令列表

Linux command

od 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Dump file in octal

od [file]

Dump in hexadecimal

od -x [file]

Dump as ASCII characters

od -c [file]

Dump with hex addresses

od -A x -t x1 [file]

Skip bytes from start

od -j [bytes] [file]

Limit output

od -N [bytes] [file]

Show all data

od -v [file]

Dump as named characters

od -a [file]

说明

od (octal dump) writes an unambiguous representation of its input to standard output. By default it displays data in octal, with each line showing an offset and the data values. The tool is useful for inspecting binary files, examining non-printable characters, and debugging data formats. Duplicate lines in the output are replaced by a single \* character unless -v is used.

参数

-A _RADIX_, --address-radix=_RADIX_
Address radix: d (decimal), o (octal), x (hex), n (none)
-t _TYPE_, --format=_TYPE_
Output type (a, c, d, f, o, u, x with optional size suffix)
-a
Named characters, same as -t a (ignores high-order bit).
-b
Octal bytes, same as -t o1.
-c
Printable characters or backslash escapes, same as -t c.
-d
Unsigned decimal, two-byte units, same as -t u2.
-f
Floating point, same as -t fF.
-i
Decimal int (sizeof(int)), same as -t dI.
-l
Decimal long, same as -t dL.
-o
Octal, two-byte units, same as -t o2.
-s
Decimal, two-byte units, same as -t d2.
-x
Hexadecimal, two-byte units, same as -t x2.
-j _BYTES_, --skip-bytes=_BYTES_
Skip BYTES input bytes first
-N _BYTES_, --read-bytes=_BYTES_
Limit dump to BYTES input bytes
-v, --output-duplicates
Do not use * to mark line suppression
-w_BYTES_, --width=_BYTES_
Output BYTES bytes per output line (default 32)
-S _BYTES_, --strings=_BYTES_
Show only NUL-terminated strings of at least BYTES printable characters
--endian={big|little}
Swap input bytes according to the specified byte order

FAQ

What is the od command used for?

od (octal dump) writes an unambiguous representation of its input to standard output. By default it displays data in octal, with each line showing an offset and the data values. The tool is useful for inspecting binary files, examining non-printable characters, and debugging data formats. Duplicate lines in the output are replaced by a single \* character unless -v is used.

How do I run a basic od example?

Run `od [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -A _RADIX_, --address-radix=_RADIX_ do in od?

Address radix: d (decimal), o (octal), x (hex), n (none)