GNU(1) User Commands GNU(1)
NNAAMMEE
GNU diff - compare files line by line
SSYYNNOOPPSSIISS
ddiiffff [_O_P_T_I_O_N]... _F_I_L_E_S
DDEESSCCRRIIPPTTIIOONN
Compare FILES line by line.
Mandatory arguments to long options are mandatory for short options
too.
----nnoorrmmaall
output a normal diff (the default)
--qq, ----bbrriieeff
report only when files differ
--ss, ----rreeppoorrtt--iiddeennttiiccaall--ffiilleess
report when two files are the same
--cc, --CC NUM, ----ccoonntteexxtt[=_N_U_M]
output NUM (default 3) lines of copied context
--uu, --UU NUM, ----uunniiffiieedd[=_N_U_M]
output NUM (default 3) lines of unified context
--ee, ----eedd
output an ed script
--nn, ----rrccss
output an RCS format diff
--yy, ----ssiiddee--bbyy--ssiiddee
output in two columns
--WW, ----wwiiddtthh=_N_U_M
output at most NUM (default 130) print columns
----lleefftt--ccoolluummnn
output only the left column of common lines
----ssuupppprreessss--ccoommmmoonn--lliinneess
do not output common lines
--pp, ----sshhooww--cc--ffuunnccttiioonn
show which C function each change is in
--FF, ----sshhooww--ffuunnccttiioonn--lliinnee=_R_E
show the most recent line matching RE
----llaabbeell LABEL
use LABEL instead of file name and timestamp (can be repeated)
--tt, ----eexxppaanndd--ttaabbss
expand tabs to spaces in output
--TT, ----iinniittiiaall--ttaabb
make tabs line up by prepending a tab
----ttaabbssiizzee=_N_U_M
tab stops every NUM (default 8) print columns
----ssuupppprreessss--bbllaannkk--eemmppttyy
suppress space or tab before empty output lines
--ll, ----ppaaggiinnaattee
pass output through 'pr' to paginate it
--rr, ----rreeccuurrssiivvee
recursively compare any subdirectories found
----nnoo--ddeerreeffeerreennccee
don't follow symbolic links
--NN, ----nneeww--ffiillee
treat absent files as empty
----uunniiddiirreeccttiioonnaall--nneeww--ffiillee
treat absent first files as empty
----iiggnnoorree--ffiillee--nnaammee--ccaassee
ignore case when comparing file names
----nnoo--iiggnnoorree--ffiillee--nnaammee--ccaassee
consider case when comparing file names
--xx, ----eexxcclluuddee=_P_A_T
exclude files that match PAT
--XX, ----eexxcclluuddee--ffrroomm=_F_I_L_E
exclude files that match any pattern in FILE
--SS, ----ssttaarrttiinngg--ffiillee=_F_I_L_E
start with FILE when comparing directories
----ffrroomm--ffiillee=_F_I_L_E_1
compare FILE1 to all operands; FILE1 can be a directory
----ttoo--ffiillee=_F_I_L_E_2
compare all operands to FILE2; FILE2 can be a directory
--ii, ----iiggnnoorree--ccaassee
ignore case differences in file contents
--EE, ----iiggnnoorree--ttaabb--eexxppaannssiioonn
ignore changes due to tab expansion
--ZZ, ----iiggnnoorree--ttrraaiilliinngg--ssppaaccee
ignore white space at line end
--bb, ----iiggnnoorree--ssppaaccee--cchhaannggee
ignore changes in the amount of white space
--ww, ----iiggnnoorree--aallll--ssppaaccee
ignore all white space
--BB, ----iiggnnoorree--bbllaannkk--lliinneess
ignore changes where lines are all blank
--II, ----iiggnnoorree--mmaattcchhiinngg--lliinneess=_R_E
ignore changes where all lines match RE
--aa, ----tteexxtt
treat all files as text
----ssttrriipp--ttrraaiilliinngg--ccrr
strip trailing carriage return on input
--DD, ----iiffddeeff=_N_A_M_E
output merged file with '#ifdef NAME' diffs
----GGTTYYPPEE--ggrroouupp--ffoorrmmaatt=_G_F_M_T
format GTYPE input groups with GFMT
----lliinnee--ffoorrmmaatt=_L_F_M_T
format all input lines with LFMT
----LLTTYYPPEE--lliinnee--ffoorrmmaatt=_L_F_M_T
format LTYPE input lines with LFMT
These format options provide fine-grained control over the out-
put
of diff, generalizing --DD/--ifdef.
LTYPE is 'old', 'new', or 'unchanged'.
GTYPE is LTYPE or 'changed'.
GFMT (only) may contain:
%< lines from FILE1
%> lines from FILE2
%= lines common to FILE1 and FILE2
%[-][WIDTH][.[PREC]]{doxX}LETTER
printf-style spec for LETTER
LETTERs are as follows for new group, lower case for old group:
F first line number
L last line number
N number of lines = L-F+1
E F-1
M L+1
%(A=B?T:E)
if A equals B then T else E
LFMT (only) may contain:
%L contents of line
%l contents of line, excluding any trailing newline
%[-][WIDTH][.[PREC]]{doxX}n
printf-style spec for input line number
Both GFMT and LFMT may contain:
%% %
%c'C' the single character C
%c'\OOO'
the character with octal code OOO
C the character C (other characters represent themselves)
--dd, ----mmiinniimmaall
try hard to find a smaller set of changes
----hhoorriizzoonn--lliinneess=_N_U_M
keep NUM lines of the common prefix and suffix
----ssppeeeedd--llaarrggee--ffiilleess
assume large files and many scattered small changes
----ccoolloorr[=_W_H_E_N]
colorize the output; WHEN can be 'never', 'always', or 'auto'
(the default)
----ppaalleettttee=_P_A_L_E_T_T_E
the colors to use when ----ccoolloorr is active; PALETTE is a
colon-separated list of terminfo capabilities
----hheellpp display this help and exit
--vv, ----vveerrssiioonn
output version information and exit
FILES are 'FILE1 FILE2' or 'DIR1 DIR2' or 'DIR FILE' or 'FILE DIR'. If
----ffrroomm--ffiillee or ----ttoo--ffiillee is given, there are no restrictions on
FILE(s). If a FILE is '-', read standard input. Exit status is 0 if
inputs are the same, 1 if different, 2 if trouble.
AAUUTTHHOORR
Written by Paul Eggert, Mike Haertel, David Hayes, Richard Stallman,
and Len Tower.
RREEPPOORRTTIINNGG BBUUGGSS
Report bugs to: bug-diffutils@gnu.org
GNU diffutils home page:
General help using GNU software:
CCOOPPYYRRIIGGHHTT
Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU
GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
SSEEEE AALLSSOO
wdiff(1), cmp(1), diff3(1), sdiff(1), patch(1)
The full documentation for GGNNUU is maintained as a Texinfo manual. If
the iinnffoo and GGNNUU programs are properly installed at your site, the com-
mand
iinnffoo GGNNUU
should give you access to the complete manual.
diffutils 3.7 December 2018 GNU(1)