← 返回命令列表

Linux command

hexdump 命令

文件

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

常用示例

Example

hexdump [path/to/file]

Example

hexdump -C [path/to/file]

Example

hexdump -C -n [number_of_bytes] [path/to/file]

Don't replace

hexdump -v [path/to/file]

说明

hexdump displays file contents in hexadecimal, decimal, octal, or ASCII formats. It's essential for examining binary files, debugging data formats, and analyzing file structures. The -C (canonical) format is most commonly used, showing offset, hex bytes, and ASCII representation side by side. By default, repeated identical lines are replaced with '*' to save space. Custom format strings (-e) allow precise control over output format for scripting and automation.

参数

-C, --canonical
Canonical hex+ASCII display (most common format)
-n, --length _LENGTH_
Interpret only _LENGTH_ bytes of input
-s, --skip _OFFSET_
Skip _OFFSET_ bytes from the beginning
-v, --no-squeezing
Display all lines (don't compress identical lines)
-e _FORMAT_
Specify custom format string
-b
One-byte octal display
-c
One-byte character display
-d
Two-byte decimal display
-o
Two-byte octal display
-x
Two-byte hexadecimal display

FAQ

What is the hexdump command used for?

hexdump displays file contents in hexadecimal, decimal, octal, or ASCII formats. It's essential for examining binary files, debugging data formats, and analyzing file structures. The -C (canonical) format is most commonly used, showing offset, hex bytes, and ASCII representation side by side. By default, repeated identical lines are replaced with '*' to save space. Custom format strings (-e) allow precise control over output format for scripting and automation.

How do I run a basic hexdump example?

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

What does -C, --canonical do in hexdump?

Canonical hex+ASCII display (most common format)