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

语法: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. centos 6.5下安装mysql

    1.检测系统是否已经安装过mysql或其依赖,若已装过要先将其删除,否则第4步使用yum安装时会报错: 1 # yum list installed | grep mysql 2 mysql-libs ...

  2. Ubuntu安装python

    一.下载 手动或者命令都行 wget http://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz 二.解压: #xz -d Python- ...

  3. asp.net 汉字转拼音类

    前段时间公司人员反应OA里的汉字拼音首字母不准他们又要用,没办法自己就从网上搜有没有好的,看了很多都是首字母拼不出来或有些字母变为另一个,但最后找了很多还是有一个好用的,暂未发现有不准的. using ...

  4. c# 类的反射实例 (GetType().Invoke().GetMethod().CreateInstance())

    原文:http://www.cnblogs.com/chenwei19/archive/2009/02/04/1384034.html Class1和Form 窗体在同一个命名空间 using Sys ...

  5. CentOS下Docker与.netcore(四)之 三剑客之一Docker-machine+jenkins简单自动化部署

    CentOS下Docker与.netcore(一) 之 安装 CentOS下Docker与.netcore(二) 之 Dockerfile CentOS下Docker与.netcore(三)之 三剑客 ...

  6. 在Linux下启动Java服务的脚本

    #!/bin/sh #该脚本为Linux下启动java程序的通用脚本.即可以作为开机自启动service脚本被调用, #也可以作为启动java程序的独立脚本来使用. # #Author: tudaxi ...

  7. 比特币解锁脚本中的ScriptSignature都包含了什么东西

    比特币 解锁脚本signature script 包含了那些东西? 使用 UTXO 需要私钥签名,私钥到底都签了什么东西呢?一直比较好奇. 比特币的私钥签名总共有五中类型,具体见 btcd 代码,如下 ...

  8. OOM AutoMapper的简单实用

    OOM  AutoMapper的简单实用 一.前言: OOM顾名思义,Object-Object-Mapping实体间相互转换,AutoMapper也是个老生常谈了,其意义在于帮助你无需手动的转换简单 ...

  9. 201621123023《Java程序设计》第1周学习总结

    第1周-Java基本概念 一.本周学习总结 关键词:java发展历史.JVM/JRE/JDK.编辑器 java是一门面向对象的语言,相比于C语言我感觉java更方便.java是运行在JVM上的,不同的 ...

  10. “全栈2019”Java第五十三章:向上转型和向下转型详解

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...