xxd,能够查看linux下文件的二进制表示。man一下xxd。能够得到下面信息

NAME

       xxd - make a hexdump or do the reverse.





SYNOPSIS

       xxd -h[elp]

       xxd [options] [infile [outfile]]

       xxd -r[evert] [options] [infile [outfile]]





DESCRIPTION

       xxd  creates  a hex dump of a given file or standard input.  It can also convert a hex dump back to its original binary form.  Like uuencode(1) and uudecode(1) it allows the

       transmission of binary data in a `mail-safe' ASCII representation, but has the advantage of decoding to standard output.  Moreover, it can be used  to  perform  binary  file

       patching.





OPTIONS

       If no infile is given, standard input is read.  If infile is specified as a `-' character, then input is taken from standard input.  If no outfile is given (or a `-' charac‐

       ter is in its place), results are sent to standard output.





       Note that a "lazy" parser is used which does not check for more than the first option letter, unless the option is followed by a parameter.  Spaces between a  single  option

       letter and its parameter are optional.  Parameters to options can be specified in decimal, hexadecimal or octal notation.  Thus -c8, -c 8, -c 010 and -cols 8 are all equiva‐

       lent.





       -a | -autoskip

              toggle autoskip: A single '*' replaces nul-lines.  Default off.





       -b | -bits

              Switch to bits (binary digits) dump, rather than hexdump.  This option writes octets as eight digits "1"s and "0"s instead of a normal hexadecimal dump. Each line  is

              preceded by a line number in hexadecimal and followed by an ascii (or ebcdic) representation. The command line switches -r, -p, -i do not work with this mode.





       -c cols | -cols cols

              format <cols> octets per line. Default 16 (-i: 12, -ps: 30, -b: 6). Max 256.





       -E | -EBCDIC

              Change  the character encoding in the righthand column from ASCII to EBCDIC.  This does not change the hexadecimal representation. The option is meaningless in combi‐

              nations with -r, -p or -i.





       -g bytes | -groupsize bytes

              separate the output of every <bytes> bytes (two hex characters or eight bit-digits each) by a whitespace.  Specify -g 0 to suppress grouping.  <Bytes> defaults  to  2

              in normal mode and 1 in bits mode.  Grouping does not apply to postscript or include style.





       -h | -help

              print a summary of available commands and exit.  No hex dumping is performed.

-i | -include

              output in C include file style. A complete static array definition is written (named after the input file), unless xxd reads from stdin.





       -l len | -len len

              stop after writing <len> octets.





       -p | -ps | -postscript | -plain

              output in postscript continuous hexdump style. Also known as plain hexdump style.





       -r | -revert

              reverse operation: convert (or patch) hexdump into binary.  If not writing to stdout, xxd writes into its output file without truncating it. Use the combination -r -p

              to read plain hexadecimal dumps without line number information and without a particular column layout. Additional Whitespace and line-breaks are allowed anywhere.





       -seek offset

              When used after -r: revert with <offset> added to file positions found in hexdump.





       -s [+][-]seek

              start at <seek> bytes abs. (or rel.) infile offset.  + indicates that the seek is relative to the current stdin file  position  (meaningless  when  not  reading  from

              stdin).   - indicates that the seek should be that many characters from the end of the input (or if combined with +: before the current stdin file position).  Without

              -s option, xxd starts at the current file position.





       -u     use upper case hex letters. Default is lower case.





       -v | -version

              show version string.

举例说明:

比方有以下这个文件叫proces_watch,假设记不住选项也没什么关系

1)、由于有些文件比較大,假设直接xxd 。那么刷屏刷的你也看不到你想要的。能够结合一下more命令进行查看

xxd 输入文件  |  more

这个时候,就能够一屏一屏的查看!

!!

2)、命令选项 -l。能够查看从文件起始查看多少个字节。比如查看前16个字节的内容

能够例如以下

xxd -l 长度 输入文件

root@user-virtual-machine:/tftpboot# xxd -l 16 process_watch
0000000: 7f45 4c46 0101 0103 0400 0000 0000 0000 .ELF............

3)、假设,这样的显示风格看着不舒服,能够使用 -g 选项,选择分组字节数,默觉得2

root@user-virtual-machine:/tftpboot# xxd -g1 -l 16 process_watch

0000000: 7f 45 4c 46 01 01 01 03 04 00 00 00 00 00 00 00  .ELF............

4)、假设想把输入文件,定位成一个数组形式。那么选择 -i选项

root@user-virtual-machine:/tftpboot# xxd -i process_watch | more
unsigned char process_watch[] = {
0x7f, 0x45, 0x4c, 0x46, 0x01, 0x01, 0x01, 0x03, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00,
0x20, 0xf6, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x04, 0x34, 0x00, 0x20, 0x00, 0x02, 0x00, 0x28, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x7f, 0x7e, 0x00, 0x00,
0x7f, 0x7e, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x60, 0x2e, 0x00, 0x00, 0x60, 0x2e, 0x02, 0x00,
0x60, 0x2e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xf2, 0xa0, 0xad, 0xd4,
0x55, 0x50, 0x58, 0x21, 0x7c, 0x08, 0x0d, 0x17, 0x00, 0x00, 0x00, 0x00,
0x40, 0x87, 0x01, 0x00, 0x40, 0x87, 0x01, 0x00, 0x34, 0x01, 0x00, 0x00,
0x92, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf9, 0x7f, 0x45, 0x4c,
0x46, 0x01, 0x64, 0x00, 0x3f, 0x02, 0x00, 0x28, 0x00, 0x7e, 0x0d, 0xbc,

5)、假设想从文件某个偏移量開始显示数据。须要用的-s选项。即s=seek

root@user-virtual-machine:/tftpboot# xxd -g1 -s 16 -l 16 process_watch
0000010: 02 00 28 00 01 00 00 00 20 f6 00 00 34 00 00 00 ..(..... ...4...

linux 命令 xxd的更多相关文章

  1. Python实现Linux命令xxd -i功能

    目录 Python实现Linux命令xxd -i功能 声明 一. Linux xxd -i功能 二. xxd -i常见用途 三. 类xxd -i功能的Python实现 Python实现Linux命令x ...

  2. linux命令 xxd

    xxd,能够查看linux下文件的二进制表示.man一下xxd.能够得到下面信息 NAME       xxd - make a hexdump or do the reverse. SYNOPSIS ...

  3. 让你的 Linux 命令骚起来

    目录 管道符号 " | " grep sed awk sort comm uniq tr cat head tail wc find tsort tee 「>」重定向符号 「 ...

  4. Linux实战教学笔记04:Linux命令基础

    第四节:Linux命令基础 标签(空格分隔):Linux实战教学笔记 第1章 认识操作环境 root:当前登陆的用户名 @分隔符 chensiqi:主机名 -:当前路径位置 用户的提示符 1.1 Li ...

  5. 像黑客一样使用 Linux 命令行

    前言 之前在博客园看到一篇介绍 IntelliJ IDEA 配置的文章,它里面用的是 gif 动态图片进行展示,我觉得很不错.所以在我今天以及以后的博文中,我也会尽量使用 gif 动图进行展示.制作 ...

  6. 11 个很少人知道但很有用的 Linux 命令

    Linux命令行吸引了大多数Linux爱好者.一个正常的Linux用户一般掌握大约50-60个命令来处理每日的任务.Linux命令和它们的转换对于Linux用户.Shell脚本程序员和管理员来说是最有 ...

  7. Linux命令随笔

    Linux命令总结 man ==命令帮助; help ==命令的帮助(bash的内置命令); ls ==list,查看目录列表; -ld:查看目录权限; -l:(long)长格式显示属性; -F:给不 ...

  8. linux命令在线手册

    下面几个网址有一些 Linux命令的在线手册,而且还是中文的,还可以搜索.非常方便 Linux命令手册 Linux命令大全 Linux中文man在线手册 每日一linux命令

  9. 常用的一些linux命令

    最近接触到一些linux环境部署的事情,下面分享一些最近使用的比较频繁的一些linux命令~ 1.一次性移动多个文件到一个文件夹里 mv  被移动文件名 -t 目标文件夹 如:mv a.txt b.t ...

随机推荐

  1. 韩国IT业是怎么走向国际我们须要学习什么

    无论从国土面积仍是从人口数量上来衡量.韩国都不能算是一个大国,而且自然资本十分缺乏,即是在这种情况下,韩国经过几十年的尽力开展变成技能大国,格外是在IT这种新经济范畴更是引人注目.并诞生了三星等国际级 ...

  2. 深刻理解Nginx之Nginx完整安装

    1.   Nginx安装 1.1预先准备 CentOS系统下,安装Nginx的库包依赖. 安装命令例如以下: sudo yum groupinstall "DevelopmentTools& ...

  3. Autodesk 举办的 Revit 2015 二次开发速成( 1.5 天),教室培训, 地点武汉

    2014年8月26日9:00 – 17:00 2014年8月27日9:00 – 12:00 培训地点: Ø 湖北工业大学 实训楼605教室 Ø 地址:武汉市武昌区南湖李家墩一村一号 Ø 交通路线说明: ...

  4. HTML5 Canvas 获取网页的像素值。

    我之前在网上看过一个插件叫做出JScolor   颜色拾取器  说白了就是通过1*1PX的DOM设置颜色值通过JS来获取当前鼠标点击位置DOM的颜色值. 自从HTML5 画布出来之后.就有更好的方法来 ...

  5. 使用CNN做电影评论的负面检测——本质上感觉和ngram或者LSTM同,因为CNN里图像检测卷积一般是3x3,而文本分类的话是直接是一维的3、4、5

    代码如下: from __future__ import division, print_function, absolute_import import tensorflow as tf impor ...

  6. intelliJ idea运行新的test功能时,报错:class not found "....." empty test suite

    转自:https://blog.csdn.net/u012560212/article/details/75037578

  7. SVN——Jenkins自动发布

    最近公司项目处于开发阶段,很多功能开发完后就需要发布到测试环境等待测试去验收,这个时候如果手动更新网站的话,是很费时费力的. 于是乎,我们做成了自动发布,这样我们只管提交代码到SVN就行了,发布由软件 ...

  8. 弹出ifame页面(jquery.reveal.js)

    <body> <a data-reveal-id="myModalDailyModify" data-animation="fade" tit ...

  9. Codeforces 994B. Knights of a Polygonal Table

    解题思路 将骑士按力量从小到大排序,到第i个骑士的时候,前面的i-1个骑士他都可以击败,找出金币最多的k个. 用multiset存金币最多的k个骑士的金币数,如果多余k个,则删除金币数最小的,直到只有 ...

  10. PAT 天梯赛练习集 L2-004. 这是二叉搜索树吗?

    题目链接: https://www.patest.cn/contests/gplt/L2-004 一棵二叉搜索树可被递归地定义为具有下列性质的二叉树:对于任一结点, 其左子树中所有结点的键值小于该结点 ...