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

语法: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}LETTER: printf-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.

转载于:https://www.cnblogs.com/davidwang456/p/3518369.html

linux diff(differential) 命令相关推荐

  1. linux双小于命令,Linux文本比较命令:diff

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

  2. Linux Diff命令用法

    Diff命令 Linux diff命令用于比较文件的差异. diff以逐行的方式,比较文本文件的异同处.如果指定要比较目录,则diff会比较目录中相同文件名的文件,但不会比较其中子目录. 语法: di ...

  3. linux diff命令_Linux diff命令示例

    linux diff命令 The Linux diff command analyses a file line by line and gives an output of a list of ch ...

  4. Linux: 举例说明Linux diff 命令

    在比较文件的时候,通常会用基于GUI的软件.很少有人真正会为了这个目的使用命 令行工具.虽然说使用命令行来比较文件/目录并不像一件小事儿那样容易,但是如果你是一个Linux使用者,那么我想你应该知道如 ...

  5. Linux diff命令详解

    diff(difference)命令常用来比较两个文件中的内容.diff 命令在最简单的情况下,比较两个文件的不同.如果使用"-"代替"文件"参数,则要比较的内 ...

  6. linux命令diff实例,举例说明Linux diff 命令

    在比较文件的时候,通常会用基于GUI的软件.很少有人真正会为了这个目的使用命令行工具.虽然说使用命令行来比较文件/目录并不像一件小事儿那样容易,但是如果你是一个Linux使用者,那么我想你应该知道如何 ...

  7. linux企业常用命令必之必会二

    本文档使用说明: 文档在整理过程中参照了书籍<linux必知必会基本命令>,同时对书中出现的不常用的命令和错误进行的挑选和删改,在学习此文档中出现的内容.有不懂的地方可以在自行查阅资料, ...

  8. Linux中常见命令和单词的缩写全称

    Linux中常见命令和单词的缩写全称 文章目录: 参考 ls:list(列出目录内容)cd:Change Directory(改变目录) su:switch user 切换用户 rpm:redhat ...

  9. linux常用shell命令面试,shell经典笔试题目总结

    shell经典笔试题目总结 守望者整理了一些高手的博客记录的shell面试题分享给大家,有些比较有意思,帮助大家面试或则学习shell编程的学习例子 一 文件内容如下: 100 a         1 ...

最新文章

  1. 你不知道的javaScript笔记(5)
  2. mysql查询哪天,Mysql日期查询的详细介绍
  3. Tengine(nginx) 搭建Tomcat集群
  4. Egit Patch
  5. 创智播客微服务_传智播客2018JavaEE IDEA版本
  6. 求两个集合的差集代码_求求你了,不要再写循环求两个列表的交集,并集和差集了 | pythonic 小技巧...
  7. transformcontrols可以用在group上吗_电缆沟盖板可以用在水沟上吗
  8. sharding-jdbc整合mybatis
  9. maccmsv10 苹果cms10 站群扩展 自用版
  10. 第四周作业二_单元测试
  11. 权威解读 GitHub、Apache 疑云:主流开源软件究竟是否会被闭源?| CSDN 独家
  12. maven安装及配置(详细版)
  13. solr mysql原理_solr replication原理探究
  14. Cesium 多边形(polygon)extrudedHeight 和 height 的区别
  15. 交换机基本原理与配置
  16. 服务器维护首先查看指示灯,HP ILO2 使用详细教程[图文]
  17. Celery入门--定时任务的开发及运行
  18. 我是这样对待曾经背叛我的女人的!
  19. 业余草告诉你甲骨文正式宣布将 Java EE 移交给 Eclipse 基金会
  20. 精制糖行业采用树脂工艺进行脱色技术分析

热门文章

  1. java面试难吗_面试两个月,整理了今年的最新java面试题,你看行吗?
  2. yum 卸载php及依赖包,yum使用指南-软件卸载、安装、更新、获取软件包
  3. Android中的Dialog
  4. auto_ptr使用介绍
  5. 计数信号量的删除与状态查询
  6. Qt中的QMainWindow
  7. 格式化字符串的几种方式
  8. pyqt5能否用于鸿蒙系统,PyQt显示来自opencv的视频流
  9. bean加载时调用@value时会出现空指针异常_SpringMVC全局异常处理机制
  10. oracle 071,Oracle_071_lesson_p3