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

语法: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. 关于SVN浏览服务器的错误

    这种错误是因为URL错误,需要把https://iZ1gyqtig7Z/svn/BoLeBang/   换成自己的公网ip地址 https://xx.xx.xx.xxsvn/BoLeBang/ 就可以 ...

  2. chipmunk 物理引擎的基本概念和基本用法

    chipmunk是一个开源2D物理引擎, 项目主页:http://code.google.com/p/chipmunk-physics/ 工作需要研究了一下,这个引擎的资料还是不多,我阅读了所有的文档 ...

  3. dataframe去重 drop_duplicates

    data.drop_duplicates() #默认:data中一行元素全部相同时才去除 data.drop_duplicates(['a','b'])#data根据’a','b'组合列删除重复项,默 ...

  4. 关于react的一些疑问点

    参考转载:链接:http://www.jianshu.com/p/83bda9cd8c67 1.refs <input type="text" ref="input ...

  5. 二,PHP缓存机制详解

    一,PHP缓存机制详解 我们可以使用PHP自带的缓存机制来完成页面静态化,但是仅靠PHP自身的缓存机制并不能完美的解决页面静态化,往往需要和其他静态化技术(通常是伪静态技术)结合使用. output ...

  6. [ActionScript 3.0] 用TextField的方法getCharIndexAtPoint(x:Number, y:Number):int实现文字在固定范围内显示

    有时候我们遇到一行文字过多时必须固定文字的显示范围,但由于中英文所占字节数不一样,所以不能很好的用截取字符的方式去统一显示范围的大小,用TextField的getCharIndexAtPoint(x: ...

  7. [Objective-C语言教程]数据类型(5)

    在Objective-C编程语言中,数据类型是指用于声明不同类型的变量或函数的扩展系统. 变量的类型决定了它在存储中占用的空间大小以及如何解释存储的位模式. Objective-C中的类型可分为以下几 ...

  8. 打扮IDEA更换主题

    原文链接:https://blog.csdn.net/github_39577257/article/details/80629750 当我们安装一个新的IDEA工具时,第一次进入时会提示我们选择一个 ...

  9. modalTransitionStyle各种present效果

    coverVertical(默认的) flipHorizontal crossDissolve partialCurl

  10. ubuntu15.04下安装jdk8

    前几天手贱,删掉了ubuntu自带的java,最后安装时遇到了Picked up JAVA_TOOL_OPTIONS的问题,经过网上各种找,终于被我弄成功了.下面将经验下载下面供大家方便: jdk8的 ...