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

语法: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. layui中折叠面板的使用

    运用折叠面板后 可以让页面更加整洁 有什么不懂的可以留言 代码放到底部 需要引入的文件 JQuery代码: html代码 <div class="layui-colla-item&qu ...

  2. Arduino I2C + 温湿度传感器HTS221

    主要特性 HTS221是意法半导体(STMicroelectronics)生产的小体积.数字式温湿度传感器IC.该IC目前在官网仍处在“评估”状态.其主要特性: 工作电压:1.7~3.6V 数据输出频 ...

  3. unity面试准备

    最近有换工作的打算 所以上网看下面试题 自己做下总结 Q:ArrayList 和 List区别 A: 1:List大家都知道初始化的时候需要定义其类型,例如 List<int> listT ...

  4. 如果使用安卓4.4的SD卡?

    安卓4.4默认情况下,后安装的程序无权写入数据到SD卡中,那么是否我们就不能用了?看了很多文章,都说要Root,随后修改配置文件.我觉得这不是很好的方法,Root之后的安卓会有很大风险,这不是最好的办 ...

  5. 【OCP-12c】CUUG最新考试原题整理及答案(071-11)

    11.(5-8) choose the best answer: Examine the structure of the BOOKS_TRANSACTIONS table. You want to ...

  6. 树莓派 Raspbian

    备注,从右往左分别是:无线鼠标一个, HDMI转VGA接口一个,网线一根,小米充电宝电源线一个.树莓派Pi 3 一台,包括读卡器一个+32G class10 SD卡一块.最后俩个U盘作为备用里面有Ar ...

  7. centos6,7中防火墙基本用法

    centos 7中 1.永久开放端口8080 firewall-cmd --zone=public --add-port=8080/tcp --permanent (添加端口后,重启防火墙后才能查看) ...

  8. Mysql:如果数据存在则更新,不存在则插入

    mysql语法支持如果数据存在则更新,不存在则插入,首先判断数据存在还是不存在的那个字段要设置成unique索引, 例如表tb_addrbook如下: 索引: 语句1:不存在插入 INSERT INT ...

  9. ifconfig无输出的原因及解决办法

    问题 执行 ifconfig 命令无任何报错,也无任何输出信息 [root@linuxprobe ~]#  ifconfig[root@linuxprobe ~]# 排错 1. 检查PATH变量 [r ...

  10. 关于CAS

    CAS就是Compare And Swap. CAS操作是在每一次做修改操作时,并不加锁,而是在修改时比较旧值是否有变化,如果旧值不变就执行修改,如果旧值有变,则修改失败. 使用sql表示就是 upd ...