• 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⊙)…没有找到我想要的结果。

  • 相关阅读:
    【Spark】scala基础操作(持续更新)
    Excel导入异常Cannot get a STRING value from a NUMERIC cell解决
    Linux系统中rpm命令用法详解
    商家冷启难题,快手每天8亿流量能解决吗?
    将自己本地项目上传到git,增加IDEA操作
    Python排序算法
    C++之内存泄漏
    模块化CSS
    Matlab的多项式留数与极点的计算
    web学习---JavaScript---笔记(一)
  • 原文地址:https://blog.csdn.net/yueni_zhao/article/details/127110889