hexdump 命令用法

本文深入解析hexdump命令的使用方法,包括参数解释、基本用法和具体例子,帮助理解如何通过hexdump命令查看文件内容的十六进制、ASCII等格式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

NAME
     hexdump - ascii, decimal, hexadecimal, octal dump

SYNOPSIS
      [-bcCdovx] [-e format_string] [-f format_file] [-n length] [-s skip] file ...

DESCRIPTION
     The hexdump utility is a filter which displays the specified files, or the standard input, if no files are specified, in a user specified format.

--------------------------------------------------------------------------------

参数及含义:
-s offset 从偏移量开始输出
-n length 只格式化输入文件的前length个字节
-v 显示所有的重复数据
-C 输出十六进制和对应字符
-e 指定格式字符串,格式字符串包含在一对单引号中

基本用法:
hexdump xxx

例子:
$ echo 'Hello, world!' > hello.txt

$ cat hello.txt 
Hello, world!

$ hexdump hello.txt
0000000 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a      
000000e

$ hexdump -C hello.txt
00000000  48 65 6c 6c 6f 2c 20 77  6f 72 6c 64 21 0a        |Hello, world!.|
0000000e

$ hexdump -s 0x7 -n 5 -v -C hello.txt 
00000007  77 6f 72 6c 64                                    |world|
0000000c

$ hexdump -s 0x7 -n 5 -v -e '16/1 "%02X " "\n"' hello.txt 

77 6F 72 6C 64 


参考资料:

1. hexdump命令使用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值