The Linux file Comparison diff command

Source: Internet
Author: User
Tags diff

Diff is the command used in Linux to compare folders and file contents in a simple and understandable language description:

Based on the file (or folder) to which the first parameter of diff points, compares the file (or folder) to which the second parameter points, and returns the result of the comparison.

(1) hold a chestnut and perform a comparison with the command diff./test1.txt./test2.txt. The two files Test1.txt and test2.txt contents are as follows:

I'm test001123 the same line test001 unique test multiple rows---gorgeous split line---

I'm test002 the same line---gorgeous split line---test002 exclusive asdf

(2) Execution results

  

Result analysis

Simply put, the letters "a", "D", and "C", respectively, are added, deleted, and modified as the results are separated from the Middle English letters.

Give me a chestnut, the first line:1,2c1

The 1th to 2nd line of the first file test1.txt is not the same as the 1th line of Test2.txt.

Then follow the following content, meaning: the 1th to 2nd line of Test1.txt is the beginning of the < section, with a different test2.txt 1th line content is > the beginning of the section,---as a split line

< I'm test001.

< 123

---

> I'm test002.

In other words:

     The 1th to 2nd line of Test1.txt is:    

I'm test001.

< 123

1th to 1th line of content with Test2.txt

I'm test002.

Different

The Linux file Comparison diff command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.