Blog

What is XDR? Extended Detection and Response

EndTech blog
diff compares the contents of two files line by line. After analyzing the files, it lists those lines that do not differ. It also provides instructions on how to change the first file to match the second file.

diff command syntax

diff [option]... file

diff command options

OptionDescription
–normalOutputs the normal diff (default)
-q, –briefIndicates only that files differ
-s, –report-identical-filesWhen files are identical, outputs information about it
-c, -C NUMBER, –context[=NUMBER]Outputs NUMBER (default 3) lines of copied context
-u, -U NUMBER, –unified[=NUMBER]Outputs NUMBER (default 3) lines of unified context
-e, –edOutputs in ed format
-n, –rcsOutputs the difference in RCS diff format
-y, –side-by-sideOutputs the result in two columns
-W, –width=NUMBEROutputs at most NUMBER (default 130) columns
–left-columnOutputs only the left column of common lines
–suppress-common-linesDoes not output common lines
-p, –show-c-functionShows the C function in which each change occurs
-F, –show-function-line=REGEXShows the last line matching REGEX
–label LABELUses LABEL instead of the filename and timestamp (can be repeated)
-t, –expand-tabsReplaces tabs with spaces in the output
-T, –initial-tabAdds a tab character at the beginning for formatting
–tabsize=NUMBERSets tab size to NUMBER (default 8) columns
–suppress-blank-emptyDoes not output spaces or tabs before empty lines
-l, –paginateProcesses output through pr, numbering pages
-r, –recursiveCompares found subdirectories recursively
–no-dereferenceDoes not follow symbolic links
-N, –new-fileTreats missing files as empty
–unidirectional-new-fileTreats missing source files as empty
–ignore-file-name-caseIgnores case when comparing file names
–no-ignore-file-name-caseDoes not ignore case when comparing file names
-x, –exclude=PATTERNExcludes files matching the PATTERN
-X, –exclude-from=FILEExcludes files matching the pattern in FILE
-S, –starting-file=FILEStarts from FILE when comparing directories
–from-file=FILE1Compares FILE1 to all items in the set (operands); FILE1 can be a directory
–to-file=FILE2Compares all items in the set (operands) to FILE2; FILE2 can be a directory
-i, –ignore-caseIgnores case in file content
-E, –ignore-tab-expansionIgnores tab expansion
-Z, –ignore-trailing-spaceIgnores whitespace at the end of the line
-b, –ignore-space-changeIgnores changes in the amount of whitespace
-w, –ignore-all-spaceIgnores all whitespace
-B, –ignore-blank-linesIgnores changes in the number of blank lines
-I, –ignore-matching-lines=REGEXIgnores changes in lines matching REGEX
-a, –textTreats all files as text
–strip-trailing-crStrips trailing carriage return (CR) in output
-D, –ifdef=NAMEOutputs combined files with differences “#ifdef NAME”
Scroll to Top