Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

day 18 - linux 命令 : diff #87

Open
hoperyy opened this issue Oct 12, 2017 · 0 comments
Open

day 18 - linux 命令 : diff #87

hoperyy opened this issue Oct 12, 2017 · 0 comments

Comments

@hoperyy
Copy link
Owner

hoperyy commented Oct 12, 2017

day 18 - linux 命令 : diff

diff 用于对比文件或文件夹

语法

diff [选项] 文件/目录 文件/目录

实例

  • 比较两个文件

    diff readme.md readme2.md
    

    对比结果中,

    • a: -add
    • c: -change
    • d: -delete
  • 并排格式输出

    diff readme.md readme2.md -y -W 50
    
  • 上下文输出

    diff readme.md readme2.md -c
    
  • 统一格式输出

    diff readme.md readme2.md -u
    
  • 比较两个目录

    diff folder1 folder2
    

    只会对比文件名相同的文件

  • 比较两个文件不同,并生产补丁

    diff readme.md readme2.md >patch.log
    
@hoperyy hoperyy added Linux and removed Linux labels Oct 12, 2017
@hoperyy hoperyy closed this as completed Apr 29, 2018
@hoperyy hoperyy reopened this May 29, 2018
@hoperyy hoperyy closed this as completed May 29, 2018
@hoperyy hoperyy reopened this May 29, 2018
@hoperyy hoperyy added 工具 and removed 2017 labels May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant