Detailed analysis of Linux diff command usage

Source: Internet
Author: User

Linux diff Function Description: Diff compares the similarities and differences of text files in line-by-line mode. If you specify a directory to be compared, diff compares the files with the same file name in the directory, but does not compare the subdirectories.
Synopsis
Diff [Options] From-file to-file
Syntax: diff [-abbcdefhilnnppqrsttuvwy] [-<number of rows>] [-C <number of rows>] [-D <giant Set Name>] [-I <character or string>] [-S <File >] [-W <width>] [-x <file or directory>] [-x <File>] [-- help] [-- left-column] [-- suppress-common -Line] [file or directory 1] [file or directory 2]

Parameters:
-X <file name or directory> or -- exclude <file name or directory> does not compare the files or directories specified in the option.
-X <File> or -- exclude-from <File> you can save the file or directory type as a text file and specify the text file in = <File>.
-Y or -- side-by-side displays Similarities and Differences of files in parallel.
-- Help: displays help.
-- When left-column uses the-y parameter, if the content of a row in the two files is the same, only the content of the row is displayed in the left column.
-- Suppress-common-lines only show differences when using the-y parameter.
-T or -- expand-Tabs expand the Tab character in the output.
-T or -- Initial-tab Add a Tab character before each line for alignment.
-U,-u <Number of columns> or -- uniied = <Number of columns> are combined to display different file content.
-V or -- version displays version information.
-W or -- ignore-all-space ignores all space characters.
-W <width> or -- width <width> when you use the-y parameter, specify the column width
-P if the file to be compared is in C Language Program The function name of the difference.
-P or -- unidirectional-New-file is similar to-N, but only when the second directory contains files not in the first directory, to compare this file with a blank file.

-Q or -- Brief only shows no difference and does not show detailed information.
-R or -- Recursive compares files in the subdirectory.
-S or -- Report-identical-files are still displayed if no difference is found.
-S <File> or -- Starting-file <File> compares directories from specified files.
-H or -- speed-large-files can accelerate the speed of large files.
-L <character or string> or -- ignore-matching-lines <character or string> If the two files have different lines, these lines both contain the characters or strings specified in the options, so the differences between the two files are not displayed.

-I or -- ignore-case do not check the case sensitivity.
-L or -- paginate submits the result to the PR program for paging.
-N or -- RCS: The comparison result is displayed in the format of RCS.
-N or -- New-file:
Only in Directory: If file a uses the-n parameter, diff compares file a with a blank file.
-C: display all internal text and mark the differences.
-C <number of rows> or -- Context <number of rows> is the same as executing the "-C-<number of rows>" command.
-D or -- minimal use different models Algorithm In a small unit.
-D <collection Name> or ifdef <collection Name> the output format of this parameter can be used for the frontend processor collection.
-E or -- ed the output format of this parameter can be used in the script file of Ed.
The format output by-f or-forward-ed is similar to that output by Ed script files, but different places are displayed in the order of the original files.
-<Number of lines> specify the number of lines of text to be displayed. This parameter must be used with the-C or-u parameter.
-A or -- text DIFF: by default, only text files are compared row by row.
-B or -- ignore-space-change do not check the difference of space characters.
-B or -- ignore-blank-lines do not check blank lines.

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.