命令介绍

diff命令可以酌行比较纯文本文件内的内容,并输出文件的差异。

命令格式

diff [option] [file1] [file2]

举例子

1)比较俩文本文件

[root@king ~]# cat test1

[root@king ~]# cat test2

[root@king ~]# diff test1 test2
,3d0 #<==删除文件1的第1行到第3行,删除文件2的第0行,即不删除。
<
<
<
6a4, #<==文件1的第6行增加下面2行文本,即文本2的第4行和第5行
>
>

2)并排格式输出

[root@king ~]# diff  -y test1 test2       #<==使用-y参数就可以并排输出。
<
<
< >
>
[root@king ~]# diff -y -W test1 test2 #<==如果觉得上面太宽,则可以使用-W参数
指定宽度。
<
<
< >
>

最新文章

  1. 为什么基于TCP UDP服务的一些简单服务端口号都是奇数
  2. Flat UI 工具包
  3. [问题2014A06] 解答
  4. html 圆角边框
  5. Sqli-labs less 26
  6. javascript实现经纬度与地址的互转
  7. 再回首,Java温故知新(十一):Java反射
  8. Android 安装过程中的问题
  9. OSG多屏显示问题
  10. iOS安全攻防之结构体保护使用
  11. EBS 系统标准职责定义MAP
  12. 利用python抓取页面数据
  13. python将文本写入剪切板
  14. linux 安装 redsi
  15. Can We Make Operating Systems Reliable and Secure?
  16. 使用 HTTP/2 提升性能的几个建议
  17. WdatePicker控件中日期的范围选择
  18. (A - 整数划分 HYSBZ - 1263)(数组模拟大数乘法)
  19. uafxcwd.lib(afxmem.obj) : error LNK2005: &quot;void * __cdecl operator new(unsigned int)&quot;解决办法
  20. java程序后台报错java.net.SocketException: Too many open files

热门文章

  1. java实现定时任务(Quartz)
  2. WCF 内置绑定在不同的传输安全模式下的信道层
  3. 并发包阻塞队列之ArrayBlockingQueue
  4. nodejs入门学习笔记二——解决阻塞问题
  5. Catch the moments of your life. Catch them while you&#39;re young and quick.
  6. [转]ubuntu16.04安装teamviewer12依赖包解决
  7. logback的加载过程
  8. 获得session中的用户信息
  9. mybatis-关联关系2
  10. Mybatis- 配置