linux命令:xxd读取二进制文件
创始人
2025-05-29 09:26:40
0

帮助文档

l@l-PC:/lib64$ xxd --help                                                                                                                                                             
Usage:                                                                                                                                                                                        xxd [options] [infile [outfile]]                                                                                                                                                       or                                                                                                                                                                                        xxd -r [-s [-]offset] [-c cols] [-ps] [infile [outfile]]                                                                                                                               
Options:                                                                                                                                                                                      -a          toggle autoskip: A single '*' replaces nul-lines. Default off.                                                                                                                -b          binary digit dump (incompatible with -ps,-i,-r). Default hex.                                                                                                                 -C          capitalize variable names in C include file style (-i).                                                                                                                       -c cols     format  octets per line. Default 16 (-i: 12, -ps: 30).                                                                                                                  -E          show characters in EBCDIC. Default ASCII.                                                                                                                                     -e          little-endian dump (incompatible with -ps,-i,-r).                                                                                                                             -g          number of octets per group in normal output. Default 2 (-e: 4).                                                                                                               -h          print this summary.-i          output in C include file style.-l len      stop after  octets.-o off      add  to the displayed file position.-ps         output in postscript plain hexdump style.-r          reverse operation: convert (or patch) hexdump into binary.-r -s off   revert with  added to file positions found in hexdump.-s [+][-]seek  start at  bytes abs. (or +: rel.) infile offset.-u          use upper case hex letters.-v          show version: "xxd V1.10 27oct98 by Juergen Weigert".

用法

直接读取xxd

l@l-PC:~$ cat 1.txt 
12345
l@l-PC:~$ xxd 1.txt 
00000000: 3132 3334 350a                           12345.

指定格式[-ps]

output in postscript plain hexdump style

l@l-PC:~$ xxd -ps  1.txt 
31323334350a

指定长度[-l 3]

l@l-PC:~$ xxd -ps -l 3  1.txt 
313233

指定偏移[-s1]

l@l-PC:~$ xxd -ps -l 3  -s1 1.txt 
323334

转换[-r]

l@l-PC:~$ xxd -ps  1.txt  > 1.bin
l@l-PC:~$ 
l@l:~$ xxd  -r -ps  1.bin
12345

相关内容

热门资讯

监控摄像头接入GB28181平... 流程简介将监控摄像头的视频在网站和APP中直播,要解决的几个问题是:1&...
Windows10添加群晖磁盘... 在使用群晖NAS时,我们需要通过本地映射的方式把NAS映射成本地的一块磁盘使用。 通过...
protocol buffer... 目录 目录 什么是protocol buffer 1.protobuf 1.1安装  1.2使用...
Fluent中创建监测点 1 概述某些仿真问题,需要创建监测点,用于获取空间定点的数据࿰...
educoder数据结构与算法...                                                   ...
MySQL下载和安装(Wind... 前言:刚换了一台电脑,里面所有东西都需要重新配置,习惯了所...
MFC文件操作  MFC提供了一个文件操作的基类CFile,这个类提供了一个没有缓存的二进制格式的磁盘...
在Word、WPS中插入AxM... 引言 我最近需要写一些文章,在排版时发现AxMath插入的公式竟然会导致行间距异常&#...
有效的括号 一、题目 给定一个只包括 '(',')','{','}'...
【Ctfer训练计划】——(三... 作者名:Demo不是emo  主页面链接:主页传送门 创作初心ÿ...