66 lines
1.8 KiB
Plaintext
66 lines
1.8 KiB
Plaintext
|
|
|
|
|
|
|
|
|
|
Command: diff - print differences between two files
|
|
Syntax: diff [-c | -e | -C n] [-br]file1 file2
|
|
Flags: -C n Produce output that contains n lines of context
|
|
-b Ignore white space when comparing
|
|
-c Produce output that contains three lines of context
|
|
-e Produce an ed-script to convert file1 into file2
|
|
-r Apply diff recursively to files and directories of
|
|
the same name, when file1 and file2 are both directories"
|
|
Examples: diff file1 file2 # Print differences between 2 files
|
|
diff -C 0 file1 file2 # Same as above
|
|
diff -C 3 file1 file2 # Output three lines of context with
|
|
every
|
|
difference encountered"
|
|
diff -c file1 file2 # Same
|
|
diff /etc /dev # Compares recursively the
|
|
directories /etc and /dev
|
|
diff passwd /etc # Compares ./passwd to /etc/passwd
|
|
|
|
Diff compares two files and generates a list of lines telling how
|
|
the two files differ. Lines may not be longer than 128 characters. If
|
|
the two arguments on the command line are both directories, diff
|
|
recursively steps through all subdirectories comparing files of the same
|
|
name. If a file name is found only in one directory, a diagnostic
|
|
message is written to stdout. A file that is of either block special,
|
|
character special or FIFO special type, cannot be compared to any other
|
|
file. On the other hand, if there is one directory and one file given
|
|
on the command line, diff tries to compare the file with the same name
|
|
as file in the directory directory.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|