linux diff(differential) 命令
功能说明:比较文件的差异。
语法: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. |
linux diff(differential) 命令的更多相关文章
- linux diff命令
diff 命令是 linux上非常重要的工具,用于比较文件的内容,特别是比较两个版本不同的文件以找到改动的地方.diff在命令行中打印每一个行的改动.最新版本的diff还支持二进制文件.diff程序的 ...
- linux diff 命令
diff 命令是 linux上非常重要的工具,用于比较文件的内容,特别是比较两个版本不同的文件以找到改动的地方.diff在命令行中打印每一个行的改动.最新版本的diff还支持二进制文件.diff程序的 ...
- linux下svn命令使用大全
最近经常使用svn进行代码管理,这些命令老是记不住,得经常上网查,终于找了一个linux下svn命令使用大全:1.将文件checkout到本地目录 svn checkout path(path是服务器 ...
- DAY1 linux 50条命令
1. tar压缩,解压缩 tar -cvf *** (压缩) tar -xvf *** (解压缩) [root@bogon ~]# tar cvf test.tar test/ test/ test ...
- linux下tar命令详解
linux下tar命令详解 tar是Linux环境下最常用的备份工具之一.tar(tap archive)原意为操作磁带文件,但基于Linux的文件操作机制,同样也可适用于普通的磁盘文件.ta ...
- Linux下svn命令详解
本文主要是说明linux下svn命令的使用方法,同时记录自己在使用中遇到的一些疑惑. 1.Linux命令行下将文件checkout到本地目录 svn checkout url(url是服务器上的目录) ...
- linux下svn命令大全
linux下svn命令大全 1.将文件checkout到本地目录 svn checkout path(path是服务器上的目录) 例如:svn checkout svn://192.168.1.1/p ...
- Linux常用脚本命令总结
基本操作 通用操作 1. export 显示所有的环境变量,也可以获取到某个变量的详细信息: export # 显示所有 echo $SHELL # 只显示SHELL 2. whereis 使用系统自 ...
- Linux系统常用命令权威指南
<一>线上查询及帮助命令(2)1.man man [选项] [命令] 查看命令帮助,命令的词典,更复杂的还有info,但不常用. #man cd-a 显示所有的手册页,不只是显示第一个-f ...
随机推荐
- [LeetCode 题解]: Triangle
前言 [LeetCode 题解]系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Given a tr ...
- SSMS查询快捷方式设置
打开SQL Server Mangement Studio,然后依次打开:工具->选项->环境->键盘->查询快捷方式,大家可以看到,SSMS已经自带了12个快捷键,其中3个已 ...
- BZOJ4710 分特产
题目链接:戳我 容斥题. 设\(f[i]\)表示至多有i个人能够分到(也就是至少n-i个人分不到)的方案数 \(f[i]=\prod_{j=1}^mC_{a[j]+i-1}^i-1\) a[j]表示的 ...
- BZOJ1901 Dynamic Rankings|带修主席树
题目链接:戳我 其实我并不会做,于是看了题解 我们都知道主席树是利用前缀和记录历史版本来搞区间K大的一种数据结构.不过一般的主席树只能搞定静态区间第K大.如果带修怎么办呢? 想一下...单点修改+区间 ...
- 恢复 MSSQL bak 文件扩展名数据(下)
恢复 MSSQL bak 文件扩展名数据 一.概念: RESTORE Statements (Transact-SQL) Restores backups taken using the BACKUP ...
- Spark - 经典案例
初识 Spark 大数据处理,目前还只是小白阶段,初步搭建起运行环境,慢慢学习之. 本文熟悉下 Spark 数据处理的几个经典案例. 首先将 Scala SDK 的源码导入 IDEA,方便查看和调试代 ...
- To 高一
Linux 坑待填 Special Judge 什么是 Special Judge?有的题目会让你输出任意一个解即可AC,或者是让你输出部分答案能取得本测试点部分得分,或者是按照方案的优秀程度给你分, ...
- gitlab容器--带https配置
#2.gitlab 重要目录 /home/maks/gitlab/config /etc/gitlab /home/maks/gitlab/logs /var/log/gitlab /home/mak ...
- 带领技术小白入门——基于java的微信公众号开发(包括服务器配置、java web项目搭建、tomcat手动发布web项目、微信开发所需的url和token验证)
微信公众号对于每个人来说都不陌生,但是许多人都不清楚是怎么开发的.身为技术小白的我,在闲暇之余研究了一下基于java的微信公众号开发.下面就是我的实现步骤,写的略显粗糙,希望大家多多提议! 一.申请服 ...
- CF1063F. String Journey(后缀数组+线段树)
题目链接 https://codeforces.com/contest/1063/problem/F 题解 虽然本题有时间复杂度较高但非常好写的做法...... 首先,若答案为 \(k\),则一定存在 ...