码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • hexdump命令使用


    hexdump可以用于以16进制格式显示文件内容

    帮助信息如下:

    hexdump --help
    1. root@hehe:/sys/bus/i2c/devices/1-0060/of_node# hexdump --help
    2. Usage:
    3. hexdump [options] <file>...
    4. Display file contents in hexadecimal, decimal, octal, or ascii.
    5. Options:
    6. -b, --one-byte-octal one-byte octal display
    7. -c, --one-byte-char one-byte character display
    8. -C, --canonical canonical hex+ASCII display
    9. -d, --two-bytes-decimal two-byte decimal display
    10. -o, --two-bytes-octal two-byte octal display
    11. -x, --two-bytes-hex two-byte hexadecimal display
    12. -L, --color[=<mode>] interpret color formatting specifiers
    13. colors are enabled by default
    14. -e, --format <format> format string to be used for displaying data
    15. -f, --format-file <file> file that contains format strings
    16. -n, --length <length> interpret only length bytes of input
    17. -s, --skip <offset> skip offset bytes from the beginning
    18. -v, --no-squeezing output identical lines
    19. -h, --help display this help and exit
    20. -V, --version output version information and exit
    21. For more details see hexdump(1).
    22. root@hehe:/sys/bus/i2c/devices/1-0060/of_node#

    读取一个文件的值:文件mclk是设备中的一个属性,其值为24 000 000就是24Mhz。十六进制是0x016e 3600。使用hexdump 读值如下所示,显然,这样读出来的值可读性很差。

    1. root@hehe:/sys/bus/i2c/devices/1-0060/of_node# hexdump mclk
    2. 0000000 6e01 0036
    3. 0000004

    那就想办法,加个参数吧

    参数-b

    1. # hexdump -b mclk
    2. 0000000 001 156 066 000
    3. 0000004

    参数-c

    1. # hexdump -c mclk
    2. 0000000 001 n 6 \0
    3. 0000004

    参数-d

    1. # hexdump -d mclk
    2. 0000000 28161 00054
    3. 0000004

    参数-C

    很显然,这个值是可以接受的。

    1. # hexdump -C mclk
    2. 00000000 01 6e 36 00 |.n6.|
    3. 00000004

    参数-o

    1. # hexdump -o mclk
    2. 0000000 067001 000066
    3. 0000004

    参数-x

    这个和不加参数时,几乎一样

    1. # hexdump -x mclk
    2. 0000000 6e01 0036
    3. 0000004

    参数-e

    这个有点复杂啊,得多写两个例子

    1. # hexdump -e '/1 "%8X"' mclk
    2. 1 6E 36 0
    1. # hexdump -e '/2 "%8X"' mclk
    2. 6E01 36
    1. # hexdump -e '/4 "%8X"' mclk
    2. 366E01

    (⊙o⊙)…没有找到我想要的结果。

  • 相关阅读:
    Hikari连接池1--初始化连接池
    Android setText 出现文本重叠的问题
    大数据开发工程师面试题
    计算机组成原理---第五章中央处理器---指令流水线---选择题
    基于单片机智能停车系统的设计与实现(论文+源码)_kaic
    基于5G网关的风力发电远程监测方案优势
    记录一次nvm切换node版本npm安装失败问题Error: Cannot find module ‘@npmcli/config‘
    HTML期末学生大作业-班级校园我的校园网页设计与实现html+css+javascript
    (水印)html转图片
    Kettle 裁剪表详解
  • 原文地址:https://blog.csdn.net/yueni_zhao/article/details/127110889
  • 最新文章
  • 【JVM】编译执行与解释执行的区别是什么?JVM 使用哪种方式?
    用 Hashids 优雅解决 C 端自增 ID 暴露问题
    V8引擎 精品漫游指南--Ignition篇(上) 指令 栈帧 槽位 调用约定 内存布局 基础内容
    LLVM Pass快速入门(四):代码插桩
    milkup:桌面端 markdown AI续写和即时渲染
    基于项目工程构建SBOM(软件物料清单)的研究
    鸿蒙应用开发UI基础第二节:鸿蒙应用程序框架核心解析与实操
    .NET 中如何快速实现 List 集合去重?
    扣子Coze实战:从0到1打造抖音+小红书热点监控智能体
    浅谈数据访问层
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号