功能说明:比较文件的差异。

语法:diff [OPTION]... FILES

实例:

diff -ur temp1 temp2

diff -ur temp1 temp2 > temp.diff

option详细:

--normal output a normal diff (This is the default).
-q--brief report only when files differ.
-s--report-identical-files report when two files are the same.
-c-C NUM, --context[=NUM] output NUM (default 3) lines of copied context.
-u-U NUM, --unified[=NUM] output NUM (default 3) lines of unified context.
-e--ed output an ed script.
-n--rcs output an RCS-format diff.
-y--side-by-side output in two columns.
-W--width=NUM output at most NUM (default 130) print columns.
--left-column output only the left column of common lines.
--suppress-common-lines do not output common lines.
-p--show-c-function show which C function each change is in.
-F--show-function-line=RE show the most recent line matching RE.
--label LABEL use LABEL instead of file name (this option can be repeated).
-t--expand-tabs expand tabs to spaces in output.
-T--initial-tab make tabs line up by prepending a tab.
--tabsize=NUM tab stops every NUM (default 8) print columns.
--suppress-blank-empty suppress space or tab before empty output lines.
-l--paginate pass output through pr to paginate it
-r--recursive recursively compare any subdirectories found.
-N--new-file treat absent files as empty.
--unidirectional-new-file treat absent first files as empty.
--ignore-file-name-case ignore case when comparing file names.
--no-ignore-file-name-case consider case when comparing file names.
-x--exclude=PAT exclude files that match PAT.
-X--exclude-from=FILE exclude files that match any pattern in FILE.
-S--starting-file=FILE start with FILE when comparing directories.
--from-file=FILE1 compare FILE1 to all operands; FILE1 can be a directory.
--to-file=FILE2 compare all operands to FILE2; FILE2 can be a directory.
-i--ignore-case ignore case differences in file contents.
-E--ignore-tab-expansion ignore changes due to tab expansion.
-b--ignore-space-change ignore changes in the amount of white space.
-w--ignore-all-space ignore all white space.
-B--ignore-blank-lines ignore changes whose lines are all blank.
-I--ignore-matching-lines=RE ignore changes whose lines all match RE.
-a--text treat all files as text.
--strip-trailing-cr strip trailing carriage return on input.
-D--ifdef=NAME output merged file with `#ifdef NAME' diffs.
--GTYPE-group-format=GFMT format GTYPE input groups with GFMT.
--line-format=LFMT format all input lines with LFMT.
--LTYPE-line-format=LFMT format LTYPE input lines with LFMT.

These format options provide fine-grained control over the output of diff, generalizing -D/--ifdef.

LTYPE is 'old', 'new', or 'unchanged'. GTYPE is LTYPE or `changed'.

GFMT (only) may contain:

%<: lines from FILE1

%>: lines from FILE2

%=: lines common to FILE1 and FILE2.

%[-][WIDTH][.[PREC]]{doxX}LETTERprintf-style spec for LETTER

LETTERs are as follows for new group, lower case for old group:

F: first line number

L: last line number

N: number of lines = L-F+1

E: F-1

M: L+1

%(A=B?T:E) if A equals B then T else E

LFMT (only) may contain:

%L: contents of line

%l: contents of line, excluding any trailing newline

%[-][WIDTH][.[PREC]]{doxX}n: printf-style spec for input line number

Both GFMT and LFMT may contain:

%%: A literal '%'

%c'C': the single character C %c'\OOO': the character with octal code OOOC: the character C (other characters represent themselves)

-d--minimal try hard to find a smaller set of changes.
--horizon-lines=NUM keep NUM lines of the common prefix and suffix.
--speed-large-files assume large files and many scattered small changes.
--help display a help message and exit.
-v--version output version information and exit.

linux diff(differential) 命令的更多相关文章

  1. linux diff命令

    diff 命令是 linux上非常重要的工具,用于比较文件的内容,特别是比较两个版本不同的文件以找到改动的地方.diff在命令行中打印每一个行的改动.最新版本的diff还支持二进制文件.diff程序的 ...

  2. linux diff 命令

    diff 命令是 linux上非常重要的工具,用于比较文件的内容,特别是比较两个版本不同的文件以找到改动的地方.diff在命令行中打印每一个行的改动.最新版本的diff还支持二进制文件.diff程序的 ...

  3. linux下svn命令使用大全

    最近经常使用svn进行代码管理,这些命令老是记不住,得经常上网查,终于找了一个linux下svn命令使用大全:1.将文件checkout到本地目录 svn checkout path(path是服务器 ...

  4. DAY1 linux 50条命令

    1. tar压缩,解压缩 tar -cvf *** (压缩) tar -xvf ***  (解压缩) [root@bogon ~]# tar cvf test.tar test/ test/ test ...

  5. linux下tar命令详解

     linux下tar命令详解    tar是Linux环境下最常用的备份工具之一.tar(tap archive)原意为操作磁带文件,但基于Linux的文件操作机制,同样也可适用于普通的磁盘文件.ta ...

  6. Linux下svn命令详解

    本文主要是说明linux下svn命令的使用方法,同时记录自己在使用中遇到的一些疑惑. 1.Linux命令行下将文件checkout到本地目录 svn checkout url(url是服务器上的目录) ...

  7. linux下svn命令大全

    linux下svn命令大全 1.将文件checkout到本地目录 svn checkout path(path是服务器上的目录) 例如:svn checkout svn://192.168.1.1/p ...

  8. Linux常用脚本命令总结

    基本操作 通用操作 1. export 显示所有的环境变量,也可以获取到某个变量的详细信息: export # 显示所有 echo $SHELL # 只显示SHELL 2. whereis 使用系统自 ...

  9. Linux系统常用命令权威指南

    <一>线上查询及帮助命令(2)1.man man [选项] [命令] 查看命令帮助,命令的词典,更复杂的还有info,但不常用. #man cd-a 显示所有的手册页,不只是显示第一个-f ...

随机推荐

  1. List分组迭代器

    说明: 针对长度较大的List对象,可以分组批量进行处理, 如:长度为1000的List对象,可分为10组,每组100条,对数据进行业务逻辑处理... Source /**************** ...

  2. 三个数组求中位数,并且求最后中位数的中位数-----C++算法实现

    文件Median.h #include <list> class CMedian { public: explicit CMedian(); virtual ~CMedian(); voi ...

  3. Robot Framework连接MySQL数据库

    注:内容来自网络,整理之如下 Robot Framework连接mysql数据库需要: 1.安装databaselibrary.pymysql 通过cmd命令执行:pip install robotf ...

  4. 张小龙演讲PPT

    35条核心要点 一.产品经理要求 1.了解人性 2.了解群体心理 3.产品经理像上帝一样,可建造系统,制定规则,让群体在系统中演化 4.提高自己的艺术品位.质量要求品位/细节体验品位:作品而非产品:工 ...

  5. VUE随笔-20181020

    常用的一些指令 -------------------------------------------------------------------------------------------- ...

  6. [Flex] 修改注释中的@author方法

    当然,在Flash Builder里,按Ctrl+Shift+D可以很方便在添加AsDoc注释,也可以修改,可是有些生成的@author是系统的用户名(如:administor),如何修改 修改方法之 ...

  7. nginx负载均衡配合keepalived服务案例实战

    本实验用4台 centos6 虚拟机,2台做负载均衡,2台做web服务器,都先装上nginx lb01:192.168.0.235  --主负载均衡器 lb02:192.168.0.236  --备负 ...

  8. localstorage在safri下的坑

    在ios10.2中的safri浏览器里无痕模式会导致localstorage不能正常使用 具体解决办法如下: if (typeof localStorage === 'object') { try { ...

  9. Tutorial 01 4,5题

    .任务四: 程序设计思想:利用Math.random()产生一个char类型的字符,再利用for循环是他们相加,最后将他们放在一个消息框中输出.   程序流程图:   源程序:           p ...

  10. python2与python3差异,以及如何写两者兼容代码

    1.路径差异: 绝对导入:跳过包内,直接搜索 sys.path ,在sys.path的基础上进行我们的模块搜索. 相对导入:先包内,再包外,再,,, python2是默认相对导入的,因此对于一般性的导 ...