xref: /freebsd/usr.bin/diff/diff.1 (revision b5daf675efc746611c7cfcd1fa474b8905064c4b)
1.\"
2.\" SPDX-License-Identifier: BSD-3-Clause
3.\"
4.\" $OpenBSD: diff.1,v 1.47 2015/11/24 19:35:41 jmc Exp $
5.\"
6.\" Copyright (c) 1980, 1990, 1993
7.\"	The Regents of the University of California.  All rights reserved.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. Neither the name of the University nor the names of its contributors
18.\"    may be used to endorse or promote products derived from this software
19.\"    without specific prior written permission.
20.\"
21.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.Dd January 7, 2025
34.Dt DIFF 1
35.Os
36.Sh NAME
37.Nm diff
38.Nd differential file and directory comparator
39.Sh SYNOPSIS
40.Nm diff
41.Op Fl aBbdipTtw
42.Oo
43.Fl c | e | f |
44.Fl n | q | u | y
45.Oc
46.Op Fl A Ar algo | Fl -algorithm Ar algo
47.Op Fl -brief
48.Op Fl -color Ns = Ns Ar when
49.Op Fl -changed-group-format Ar GFMT
50.Op Fl -ed
51.Op Fl -expand-tabs
52.Op Fl -forward-ed
53.Op Fl -ignore-all-space
54.Op Fl -ignore-case
55.Op Fl -ignore-space-change
56.Op Fl -initial-tab
57.Op Fl -minimal
58.Op Fl -no-dereference
59.Op Fl -no-ignore-file-name-case
60.Op Fl -normal
61.Op Fl -rcs
62.Op Fl -show-c-function
63.Op Fl -starting-file
64.Op Fl -speed-large-files
65.Op Fl -strip-trailing-cr
66.Op Fl -tabsize Ar number
67.Op Fl -text
68.Op Fl -unified
69.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern
70.Op Fl F Ar pattern | Fl -show-function-line Ar pattern
71.Op Fl L Ar label | Fl -label Ar label
72.Ar file1 file2
73.Nm diff
74.Op Fl aBbdilpTtw
75.Op Fl A Ar algo | Fl -algorithm Ar algo
76.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern
77.Op Fl F Ar pattern | Fl -show-function-line Ar pattern
78.Op Fl L Ar label | Fl -label Ar label
79.Op Fl -brief
80.Op Fl -color Ns = Ns Ar when
81.Op Fl -changed-group-format Ar GFMT
82.Op Fl -ed
83.Op Fl -expand-tabs
84.Op Fl -forward-ed
85.Op Fl -ignore-all-space
86.Op Fl -ignore-case
87.Op Fl -ignore-space-change
88.Op Fl -initial-tab
89.Op Fl -minimal
90.Op Fl -no-dereference
91.Op Fl -no-ignore-file-name-case
92.Op Fl -normal
93.Op Fl -paginate
94.Op Fl -rcs
95.Op Fl -show-c-function
96.Op Fl -speed-large-files
97.Op Fl -starting-file
98.Op Fl -strip-trailing-cr
99.Op Fl -tabsize Ar number
100.Op Fl -text
101.Fl C Ar number | Fl -context Ar number
102.Ar file1 file2
103.Nm diff
104.Op Fl aBbdiltw
105.Op Fl A Ar algo | Fl -algorithm Ar algo
106.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern
107.Op Fl -brief
108.Op Fl -color Ns = Ns Ar when
109.Op Fl -changed-group-format Ar GFMT
110.Op Fl -ed
111.Op Fl -expand-tabs
112.Op Fl -forward-ed
113.Op Fl -ignore-all-space
114.Op Fl -ignore-case
115.Op Fl -ignore-space-change
116.Op Fl -initial-tab
117.Op Fl -minimal
118.Op Fl -no-dereference
119.Op Fl -no-ignore-file-name-case
120.Op Fl -normal
121.Op Fl -paginate
122.Op Fl -rcs
123.Op Fl -show-c-function
124.Op Fl -speed-large-files
125.Op Fl -starting-file
126.Op Fl -strip-trailing-cr
127.Op Fl -tabsize Ar number
128.Op Fl -text
129.Fl D Ar string | Fl -ifdef Ar string
130.Ar file1 file2
131.Nm diff
132.Op Fl aBbdilpTtw
133.Op Fl A Ar algo | Fl -algorithm Ar algo
134.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern
135.Op Fl F Ar pattern | Fl -show-function-line Ar pattern
136.Op Fl L Ar label | Fl -label Ar label
137.Op Fl -brief
138.Op Fl -color Ns = Ns Ar when
139.Op Fl -changed-group-format Ar GFMT
140.Op Fl -ed
141.Op Fl -expand-tabs
142.Op Fl -forward-ed
143.Op Fl -ignore-all-space
144.Op Fl -ignore-case
145.Op Fl -ignore-space-change
146.Op Fl -initial-tab
147.Op Fl -minimal
148.Op Fl -no-dereference
149.Op Fl -no-ignore-file-name-case
150.Op Fl -normal
151.Op Fl -paginate
152.Op Fl -rcs
153.Op Fl -show-c-function
154.Op Fl -speed-large-files
155.Op Fl -starting-file
156.Op Fl -strip-trailing-cr
157.Op Fl -tabsize Ar number
158.Op Fl -text
159.Fl U Ar number | Fl -unified Ar number
160.Ar file1 file2
161.Nm diff
162.Op Fl aBbdilNPprsTtw
163.Oo
164.Fl c | e | f |
165.Fl n | q | u
166.Oc
167.Op Fl A Ar algo | Fl -algorithm Ar algo
168.Op Fl -brief
169.Op Fl -color Ns = Ns Ar when
170.Op Fl -changed-group-format Ar GFMT
171.Op Fl -context
172.Op Fl -ed
173.Op Fl -expand-tabs
174.Op Fl -forward-ed
175.Op Fl -ignore-all-space
176.Op Fl -ignore-case
177.Op Fl -ignore-space-change
178.Op Fl -initial-tab
179.Op Fl -minimal
180.Op Fl -new-file
181.Op Fl -no-dereference
182.Op Fl -no-ignore-file-name-case
183.Op Fl -normal
184.Op Fl -paginate
185.Op Fl -rcs
186.Op Fl -recursive
187.Op Fl -report-identical-files
188.Op Fl -show-c-function
189.Op Fl -speed-large-files
190.Op Fl -strip-trailing-cr
191.Op Fl -tabsize Ar number
192.Op Fl -text
193.Op Fl -unidirectional-new-file
194.Op Fl -unified
195.Op Fl I Ar pattern | Fl -ignore-matching-lines Ar pattern
196.Op Fl F Ar pattern | Fl -show-function-line Ar pattern
197.Bk -words
198.Op Fl L Ar label | Fl -label Ar label
199.Op Fl S Ar name | Fl -starting-file Ar name
200.Op Fl X Ar file | Fl -exclude-from Ar file
201.Op Fl x Ar pattern | Fl -exclude Ar pattern
202.Ek
203.Ar dir1 dir2
204.Nm diff
205.Op Fl aBbditwW
206.Op Fl -color Ns = Ns Ar when
207.Op Fl -expand-tabs
208.Op Fl -ignore-all-space
209.Op Fl -ignore-blank-lines
210.Op Fl -ignore-case
211.Op Fl -minimal
212.Op Fl -no-dereference
213.Op Fl -no-ignore-file-name-case
214.Op Fl -strip-trailing-cr
215.Op Fl -suppress-common-lines
216.Op Fl -tabsize Ar number
217.Op Fl -text
218.Op Fl -width
219.Fl y | Fl -side-by-side
220.Ar file1 file2
221.Nm diff
222.Op Fl -help
223.Op Fl -version
224.Sh DESCRIPTION
225The
226.Nm
227utility compares the contents of
228.Ar file1
229and
230.Ar file2
231and writes to the standard output the list of changes necessary to
232convert one file into the other.
233No output is produced if the files are identical.
234.Pp
235Output options (mutually exclusive):
236.Bl -tag -width Ds
237.It Fl C Ar number Fl -context Ar number
238Like
239.Fl c
240but produces a diff with
241.Ar number
242lines of context.
243.It Fl c
244Produces a diff with 3 lines of context.
245With
246.Fl c
247the output format is modified slightly:
248the output begins with identification of the files involved and
249their creation dates and then each change is separated
250by a line with fifteen
251.Li * Ns 's .
252The lines removed from
253.Ar file1
254are marked with
255.Sq \&-\ \& ;
256those added to
257.Ar file2
258are marked
259.Sq +\ \& .
260Lines which are changed from one file to the other are marked in
261both files with
262.Sq !\ \& .
263Changes which lie within 3 lines of each other are grouped together on
264output.
265.It Fl D Ar string Fl -ifdef Ar string
266Creates a merged version of
267.Ar file1
268and
269.Ar file2
270on the standard output, with C preprocessor controls included so that
271a compilation of the result without defining
272.Ar string
273is equivalent to compiling
274.Ar file1 ,
275while defining
276.Ar string
277will yield
278.Ar file2 .
279.It Fl e -ed
280Produces output in a form suitable as input for the editor utility,
281.Xr ed 1 ,
282which can then be used to convert file1 into file2.
283.Pp
284Extra commands are added to the output when comparing directories with
285.Fl e ,
286so that the result is a
287.Xr sh 1
288script for converting text files which are common to the two directories
289from their state in
290.Ar dir1
291to their state in
292.Ar dir2 .
293Note that when comparing directories with
294.Fl e ,
295the resulting file may no longer be interpreted as an
296.Xr ed 1
297script.
298Output is added to indicate which file each set of
299.Xr ed 1
300commands applies to.
301These hunks can be manually extracted to produce an
302.Xr ed 1
303script, which can also be applied with
304.Xr patch 1 .
305.It Fl f -forward-ed
306Identical output to that of the
307.Fl e
308flag, but in reverse order.
309It cannot be digested by
310.Xr ed 1 .
311.It Fl -help
312This option prints a summary to stdout and exits with status 0.
313.It Fl n
314Produces a script similar to that of
315.Fl e ,
316but in the opposite order and with a count of changed lines on each
317insert or delete command.
318This is the form used by rcsdiff.
319.It Fl q -brief
320Just print a line when the files differ.
321Does not output a list of changes.
322.It Fl U Ar number Fl -unified Ar number
323Like
324.Fl u
325but produces a diff with
326.Ar number
327lines of context.
328.It Fl u
329Produces a
330.Em unified
331diff with 3 lines of context.
332A unified diff is similar to the context diff produced by the
333.Fl c
334option.
335However, unlike with
336.Fl c ,
337all lines to be changed (added and/or removed) are present in
338a single section.
339.It Fl -version
340This option prints a version string to stdout and exits with status 0.
341.It Fl y Fl -side-by-side
342Output in two columns with a marker between them.
343The marker can be one
344of the following:
345.Pp
346.Bl -tag -width Ds -offset indent -compact
347.It space
348Corresponding lines are identical.
349.It '|'
350Corresponding lines are different.
351.It '<'
352Files differ and only the first file contains the line.
353.It '>'
354Files differ and only the second file contains the line.
355.El
356.El
357.Pp
358Comparison options:
359.Bl -tag -width Ds
360.It Fl A Ar algo , Fl -algorithm Ar algo
361Configure the algorithm used when comparing files.
362.Nm
363supports 3 algorithms:
364.Pp
365.Bl -tag -width Ds -compact
366.It Cm myers
367The Myers diff algorithm finds the shortest edit which transforms one
368input into the other.
369It generally runs in O(N+D\(S2) time, requiring O(N) space, where N is
370the sum of the lengths of the inputs and D is the length of the
371difference between them, with a theoretical O(N\(pcD) worst case.
372If it encounters worst-case input, the implementation used by
373.Nm
374falls back to a less optimal but faster algorithm.
375.It Cm patience
376The Patience variant of the Myers algorithm attempts to create more
377aesthetically pleasing diff output by logically grouping lines.
378.It Cm stone
379The Stone algorithm (commonly known as Hunt-McIlroy or Hunt-Szymanski)
380looks for the longest common subsequence between compared files.
381Stone encounters worst case performance when there are long common
382subsequences.
383In large files this can lead to a significant performance impact.
384The Stone algorithm is maintained for compatibility.
385.El
386.Pp
387The
388.Nm
389utility defaults to the Myers algorithm, but will fall back to the
390Stone algorithm if the input or output options are not supported by
391the Myers implementation.
392.It Fl a -text
393Treat all files as ASCII text.
394Normally
395.Nm
396will simply print
397.Dq Binary files ... differ
398if files contain binary characters.
399Use of this option forces
400.Nm
401to produce a diff.
402.It Fl B Fl -ignore-blank-lines
403Causes chunks that include only blank lines to be ignored.
404.It Fl b -ignore-space-change
405Causes trailing blanks (spaces and tabs) to be ignored, and other
406strings of blanks to compare equal.
407.It Fl -color= Ns Oo Ar when Oc
408Color the additions green, and removals red, or the value in the
409.Ev DIFFCOLORS
410environment variable.
411The possible values of
412.Ar when
413are
414.Dq Cm never ,
415.Dq Cm always
416and
417.Dq Cm auto .
418.Cm auto
419will use color if the output is a tty and the
420.Ev COLORTERM
421environment variable is set to a non-empty string.
422.It Fl d -minimal
423Try very hard to produce a diff as small as possible.
424This may consume a lot of processing power and memory when processing
425large files with many changes.
426.It Fl F Ar pattern , Fl -show-function-line Ar pattern
427Like
428.Fl p ,
429but display the last line that matches provided pattern.
430.It Fl I Ar pattern Fl -ignore-matching-lines Ar pattern
431Ignores changes, insertions, and deletions whose lines match the
432extended regular expression
433.Ar pattern .
434Multiple
435.Fl I
436patterns may be specified.
437All lines in the change must match some pattern for the change to be
438ignored.
439See
440.Xr re_format 7
441for more information on regular expression patterns.
442.It Fl i -ignore-case
443Ignores the case of letters.
444E.g.,
445.Dq A
446will compare equal to
447.Dq a .
448.It Fl l -paginate
449Pass the output through
450.Xr pr 1
451to paginate it.
452.It Fl L Ar label Fl -label Ar label
453Print
454.Ar label
455instead of the first (and second, if this option is specified twice)
456file name and time in the context or unified diff header.
457.It Fl p -show-c-function
458With unified and context diffs, show with each change
459the first 40 characters of the last line before the context beginning
460with a letter, an underscore or a dollar sign.
461For C and Objective-C source code following standard layout conventions, this
462will show the prototype of the function the change applies to.
463.It Fl T -initial-tab
464Print a tab rather than a space before the rest of the line for the
465normal, context or unified output formats.
466This makes the alignment of tabs in the line consistent.
467.It Fl t -expand-tabs
468Will expand tabs in output lines.
469Normal or
470.Fl c
471output adds character(s) to the front of each line which may screw up
472the indentation of the original source lines and make the output listing
473difficult to interpret.
474This option will preserve the original source's indentation.
475.It Fl w -ignore-all-space
476Is similar to
477.Fl b -ignore-space-change
478but causes whitespace (blanks and tabs) to be totally ignored.
479E.g.,
480.Dq if (\ \&a == b \&)
481will compare equal to
482.Dq if(a==b) .
483.It Fl W Ar number Fl -width Ar number
484Output at most
485.Ar number
486columns when using side by side format.
487The default value is 130.
488Note that unless
489.Fl t
490was specified,
491.Nm
492will always align the second column to a tab stop, so values of
493.Fl -width
494smaller than approximately five times the value of
495.Fl -tabsize
496may yield surprising results.
497.It Fl -changed-group-format Ar GFMT
498Format input groups in the provided
499.Pp
500the format is a string with special keywords:
501.Bl -tag -width %<
502.It %<
503lines from FILE1
504.It %<
505lines from FILE2
506.El
507.It Fl -ignore-file-name-case
508ignore case when comparing file names
509.It Fl -no-dereference
510do not follow symbolic links
511.It Fl -no-ignore-file-name-case
512do not ignore case when comparing file names (default)
513.It Fl -normal
514default diff output
515.It Fl -speed-large-files
516stub option for compatibility with GNU diff
517.It Fl -strip-trailing-cr
518strip carriage return on input files
519.It Fl -suppress-common-lines
520Do not output common lines when using the side by side format
521.It Fl -tabsize Ar number
522Number of spaces representing a tab (default 8)
523.El
524.Pp
525Directory comparison options:
526.Bl -tag -width Ds
527.It Fl N -new-file
528If a file is found in only one directory, act as if it was found in the
529other directory too but was of zero size.
530.It Fl P -unidirectional-new-file
531If a file is found only in
532.Ar dir2 ,
533act as if it was found in
534.Ar dir1
535too but was of zero size.
536.It Fl r -recursive
537Causes application of
538.Nm
539recursively to common subdirectories encountered.
540.It Fl S Ar name Fl -starting-file Ar name
541Re-starts a directory
542.Nm
543in the middle, beginning with file
544.Ar name .
545.It Fl s -report-identical-files
546Causes
547.Nm
548to report files which are the same, which are otherwise not mentioned.
549.It Fl X Ar file Fl -exclude-from Ar file
550Exclude files and subdirectories from comparison whose basenames match
551lines in
552.Ar file .
553Multiple
554.Fl X
555options may be specified.
556.It Fl x Ar pattern Fl -exclude Ar pattern
557Exclude files and subdirectories from comparison whose basenames match
558.Ar pattern .
559Patterns are matched using shell-style globbing via
560.Xr fnmatch 3 .
561Multiple
562.Fl x
563options may be specified.
564.El
565.Pp
566If both arguments are directories,
567.Nm
568sorts the contents of the directories by name, and then runs the
569regular file
570.Nm
571algorithm, producing a change list,
572on text files which are different.
573Binary files which differ,
574common subdirectories, and files which appear in only one directory
575are described as such.
576In directory mode only regular files and directories are compared.
577If a non-regular file such as a device special file or FIFO is encountered,
578a diagnostic message is printed.
579.Pp
580If only one of
581.Ar file1
582and
583.Ar file2
584is a directory,
585.Nm
586is applied to the non-directory file and the file contained in
587the directory file with a filename that is the same as the
588last component of the non-directory file.
589.Pp
590If either
591.Ar file1
592or
593.Ar file2
594is
595.Sq - ,
596the standard input is
597used in its place.
598.Ss Output Style
599The default (without
600.Fl e ,
601.Fl c ,
602or
603.Fl n -rcs
604.\" -C
605options)
606output contains lines of these forms, where
607.Va XX , YY , ZZ , QQ
608are line numbers respective of file order.
609.Pp
610.Bl -tag -width "XX,YYcZZ,QQ" -compact
611.It Li XX Ns Ic a Ns Li YY
612At (the end of) line
613.Va XX
614of
615.Ar file1 ,
616append the contents
617of line
618.Va YY
619of
620.Ar file2
621to make them equal.
622.It Li XX Ns Ic a Ns Li YY,ZZ
623Same as above, but append the range of lines,
624.Va YY
625through
626.Va ZZ
627of
628.Ar file2
629to line
630.Va XX
631of file1.
632.It Li XX Ns Ic d Ns Li YY
633At line
634.Va XX
635delete
636the line.
637The value
638.Va YY
639tells to which line the change would bring
640.Ar file1
641in line with
642.Ar file2 .
643.It Li XX,YY Ns Ic d Ns Li ZZ
644Delete the range of lines
645.Va XX
646through
647.Va YY
648in
649.Ar file1 .
650.It Li XX Ns Ic c Ns Li YY
651Change the line
652.Va XX
653in
654.Ar file1
655to the line
656.Va YY
657in
658.Ar file2 .
659.It Li XX,YY Ns Ic c Ns Li ZZ
660Replace the range of specified lines with the line
661.Va ZZ .
662.It Li XX,YY Ns Ic c Ns Li ZZ,QQ
663Replace the range
664.Va XX , Ns Va YY
665from
666.Ar file1
667with the range
668.Va ZZ , Ns Va QQ
669from
670.Ar file2 .
671.El
672.Pp
673These lines resemble
674.Xr ed 1
675subcommands to convert
676.Ar file1
677into
678.Ar file2 .
679The line numbers before the action letters pertain to
680.Ar file1 ;
681those after pertain to
682.Ar file2 .
683Thus, by exchanging
684.Ic a
685for
686.Ic d
687and reading the line in reverse order, one can also
688determine how to convert
689.Ar file2
690into
691.Ar file1 .
692As in
693.Xr ed 1 ,
694identical
695pairs (where num1 = num2) are abbreviated as a single
696number.
697.Sh ENVIRONMENT
698.Bl -tag -width DIFFCOLORS
699.It Ev DIFFCOLORS
700The value of this variable is the form
701.Ar add : Ns Ar rm ,
702where
703.Ar add
704is the ASCII escape sequence for additions and
705.Ar rm
706is the ASCII escape sequence for deletions.
707If this is unset,
708.Nm
709uses green for additions and red for removals.
710.El
711.Sh FILES
712.Bl -tag -width /tmp/diff.XXXXXXXX -compact
713.It Pa /tmp/diff.XXXXXXXX
714Temporary file used when comparing a device or the standard input.
715Note that the temporary file is unlinked as soon as it is created
716so it will not show up in a directory listing.
717.El
718.Sh EXIT STATUS
719The
720.Nm
721utility exits with one of the following values:
722.Pp
723.Bl -tag -width Ds -offset indent -compact
724.It 0
725No differences were found.
726.It 1
727Differences were found.
728.It >1
729An error occurred.
730.El
731.Pp
732The
733.Fl -help
734and
735.Fl -version
736options exit with a status of 0.
737.Sh EXAMPLES
738Compare
739.Pa old_dir
740and
741.Pa new_dir
742recursively generating an unified diff and treating files found only in one
743of those directories as new files:
744.Bd -literal -offset indent
745$ diff -ruN /path/to/old_dir /path/to/new_dir
746.Ed
747.Pp
748Same as above but excluding files matching the expressions
749.Dq *.h
750and
751.Dq *.c :
752.Bd -literal -offset indent
753$ diff -ruN -x '*.h' -x '*.c' /path/to/old_dir /path/to/new_dir
754.Ed
755.Pp
756Show a single line indicating if the files differ:
757.Bd -literal -offset indent
758$ diff -q /boot/loader.conf /boot/defaults/loader.conf
759Files /boot/loader.conf and /boot/defaults/loader.conf differ
760.Ed
761.Pp
762Assuming a file named
763.Pa example.txt
764with the following contents:
765.Bd -literal -offset indent
766FreeBSD is an operating system
767Linux is a kernel
768OpenBSD is an operating system
769.Ed
770.Pp
771Compare stdin with
772.Pa example.txt
773excluding from the comparison those lines containing either
774.Qq Linux
775or
776.Qq Open :
777.Bd -literal -offset indent
778$ echo "FreeBSD is an operating system" | diff -q -I 'Linux|Open' example.txt -
779.Ed
780.Sh SEE ALSO
781.Xr cmp 1 ,
782.Xr comm 1 ,
783.Xr diff3 1 ,
784.Xr ed 1 ,
785.Xr patch 1 ,
786.Xr pr 1 ,
787.Xr sdiff 1
788.Rs
789.%A James W. Hunt
790.%A M. Douglas McIlroy
791.%T "An Algorithm for Differential File Comparison"
792.%J Computing Science Technical Report
793.%Q Bell Laboratories 41
794.%D June 1976
795.Re
796.Sh STANDARDS
797The
798.Nm
799utility is compliant with the
800.St -p1003.1-2008
801specification.
802.Pp
803The flags
804.Op Fl AaDdIiLlNnPpqSsTtwXxy
805are extensions to that specification.
806.Sh HISTORY
807A
808.Nm
809command appeared in
810.At v6 .
811The
812.Nm
813implementation used in
814.Fx
815was GNU diff until
816.Fx 11.4 .
817This was replaced in
818.Fx 12.0
819by a BSD-licensed implementation written by
820.An Todd Miller .
821Some GNUisms were lost in the process.
822.Pp
823libdiff was imported from the Game of Trees version control system and default
824algorithm was changed to Myers for
825.Fx 15 .
826