Blog
What is XDR? Extended Detection and Response

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
Option | Description |
---|---|
–normal | Outputs the normal diff (default) |
-q, –brief | Indicates only that files differ |
-s, –report-identical-files | When 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, –ed | Outputs in ed format |
-n, –rcs | Outputs the difference in RCS diff format |
-y, –side-by-side | Outputs the result in two columns |
-W, –width=NUMBER | Outputs at most NUMBER (default 130) columns |
–left-column | Outputs only the left column of common lines |
–suppress-common-lines | Does not output common lines |
-p, –show-c-function | Shows the C function in which each change occurs |
-F, –show-function-line=REGEX | Shows the last line matching REGEX |
–label LABEL | Uses LABEL instead of the filename and timestamp (can be repeated) |
-t, –expand-tabs | Replaces tabs with spaces in the output |
-T, –initial-tab | Adds a tab character at the beginning for formatting |
–tabsize=NUMBER | Sets tab size to NUMBER (default 8) columns |
–suppress-blank-empty | Does not output spaces or tabs before empty lines |
-l, –paginate | Processes output through pr, numbering pages |
-r, –recursive | Compares found subdirectories recursively |
–no-dereference | Does not follow symbolic links |
-N, –new-file | Treats missing files as empty |
–unidirectional-new-file | Treats missing source files as empty |
–ignore-file-name-case | Ignores case when comparing file names |
–no-ignore-file-name-case | Does not ignore case when comparing file names |
-x, –exclude=PATTERN | Excludes files matching the PATTERN |
-X, –exclude-from=FILE | Excludes files matching the pattern in FILE |
-S, –starting-file=FILE | Starts from FILE when comparing directories |
–from-file=FILE1 | Compares FILE1 to all items in the set (operands); FILE1 can be a directory |
–to-file=FILE2 | Compares all items in the set (operands) to FILE2; FILE2 can be a directory |
-i, –ignore-case | Ignores case in file content |
-E, –ignore-tab-expansion | Ignores tab expansion |
-Z, –ignore-trailing-space | Ignores whitespace at the end of the line |
-b, –ignore-space-change | Ignores changes in the amount of whitespace |
-w, –ignore-all-space | Ignores all whitespace |
-B, –ignore-blank-lines | Ignores changes in the number of blank lines |
-I, –ignore-matching-lines=REGEX | Ignores changes in lines matching REGEX |
-a, –text | Treats all files as text |
–strip-trailing-cr | Strips trailing carriage return (CR) in output |
-D, –ifdef=NAME | Outputs combined files with differences “#ifdef NAME” |