← 返回命令列表

Linux command

hd 命令

文件

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

常用示例

Display file in hex

hd [file]

Show first 100 bytes

hd -n 100 [file]

Skip first 50 bytes

hd -s 50 [file]

One-byte octal display

hd -b [file]

Canonical hex+ASCII display

hd -C [file]

说明

hd displays file contents in hexadecimal format. It's equivalent to hexdump -C, showing both hex values and ASCII representation. The tool is useful for examining binary files, analyzing data formats, and debugging. It formats output in readable columns.

参数

-n _LENGTH_
Number of bytes to display.
-s _OFFSET_
Skip offset bytes.
-b
One-byte octal display.
-C
Canonical hex+ASCII display.
-v
Display all data (no suppression).
--help
Display help information.

FAQ

What is the hd command used for?

hd displays file contents in hexadecimal format. It's equivalent to hexdump -C, showing both hex values and ASCII representation. The tool is useful for examining binary files, analyzing data formats, and debugging. It formats output in readable columns.

How do I run a basic hd example?

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

What does -n _LENGTH_ do in hd?

Number of bytes to display.