TEXT   147

diff.txt

Guest on 1st August 2021 05:56:39 PM

  1. NAME
  2.        diff - find differences between two files
  3.  
  4.  
  5.  
  6. SYNOPSIS
  7.        diff [options] from-file to-file
  8.  
  9.  
  10.  
  11. DESCRIPTION
  12.        In  the  simplest  case, diff compares the contents of the
  13.        two files from-file and to-file.  A file name of -  stands
  14.        for text read from the standard input.  As a special case,
  15.        diff - - compares a copy of standard input to itself.
  16.  
  17.        If from-file is a directory and to-file is not, diff  com-
  18.        pares the file in from-file whose file name is that of to-
  19.        file, and vice versa.  The non-directory file must not  be
  20.        -.
  21.  
  22.        If  both  from-file and to-file are directories, diff com-
  23.        pares corresponding files in both directories,  in  alpha-
  24.        betical order; this comparison is not recursive unless the
  25.        -r or --recursive option is given.   diff  never  compares
  26.        the  actual  contents of a directory as if it were a file.
  27.        The file that is  fully  specified  may  not  be  standard
  28.        input,  because  standard input is nameless and the notion
  29.        of ``file with the same name'' does not apply.
  30.  
  31.        diff options begin with -, so normally from-file  and  to-
  32.        file  may not begin with -.  However, -- as an argument by
  33.        itself treats the remaining arguments as file  names  even
  34.        if they begin with -.
  35.  
  36.    Options
  37.        Below  is  a  summary  of all of the options that GNU diff
  38.        accepts.  Most options have two equivalent names,  one  of
  39.        which  is  a single letter preceded by -, and the other of
  40.        which is a long name preceded by --.  Multiple single let-
  41.        ter options (unless they take an argument) can be combined
  42.        into a single command line word: -ac is equivalent  to  -a
  43.        -c.   Long  named options can be abbreviated to any unique
  44.        prefix of their name.  Brackets ([ and ]) indicate that an
  45.        option takes an optional argument.
  46.  
  47.        -lines Show  lines  (an  integer)  lines of context.  This
  48.               option does not specify an output format by itself;
  49.               it  has  no effect unless it is combined with -c or
  50.               -u.  This option is obsolete.   For  proper  opera-
  51.               tion,  patch  typically needs at least two lines of
  52.               context.
  53.  
  54.        -a     Treat all files as text and compare  them  line-by-
  55.               line, even if they do not seem to be text.
  56.  
  57.        -b     Ignore changes in amount of white space.
  58.  
  59.        -B     Ignore  changes  that  just  insert or delete blank
  60.               lines.
  61.  
  62.        --brief
  63.               Report only  whether  the  files  differ,  not  the
  64.               details of the differences.
  65.  
  66.        -c     Use the context output format.
  67.  
  68.        -C lines
  69.        --context[=lines]
  70.               Use  the  context  output format, showing lines (an
  71.               integer) lines of context, or three if lines is not
  72.               given.  For proper operation, patch typically needs
  73.               at least two lines of context.
  74.  
  75.        --changed-group-format=format
  76.               Use format to output a line group  containing  dif-
  77.               fering  lines  from both files in if-then-else for-
  78.               mat.
  79.  
  80.        -d     Change the algorithm to perhaps find a smaller  set
  81.               of changes.  This makes diff slower (sometimes much
  82.               slower).
  83.  
  84.        -D name
  85.               Make merged if-then-else format output, conditional
  86.               on the preprocessor macro name.
  87.  
  88.        -e
  89.        --ed   Make output that is a valid ed script.
  90.  
  91.        --exclude=pattern
  92.               When comparing directories, ignore files and subdi-
  93.               rectories whose basenames match pattern.
  94.  
  95.        --exclude-from=file
  96.               When comparing directories, ignore files and subdi-
  97.               rectories  whose  basenames  match any pattern con-
  98.               tained in file.
  99.  
  100.        --expand-tabs
  101.               Expand tabs to spaces in the  output,  to  preserve
  102.               the alignment of tabs in the input files.
  103.  
  104.        -f     Make  output  that  looks vaguely like an ed script
  105.               but has changes in the order  they  appear  in  the
  106.               file.
  107.  
  108.        -F regexp
  109.               In  context  and  unified  format, for each hunk of
  110.               differences, show some of the last  preceding  line
  111.               that matches regexp.
  112.  
  113.        --forward-ed
  114.               Make  output  that  looks vaguely like an ed script
  115.               but has changes in the order  they  appear  in  the
  116.               file.
  117.  
  118.        -h     This  option currently has no effect; it is present
  119.               for Unix compatibility.
  120.  
  121.        -H     Use heuristics to speed  handling  of  large  files
  122.               that have numerous scattered small changes.
  123.  
  124.        --horizon-lines=lines
  125.               Do  not  discard the last lines lines of the common
  126.               prefix and the first lines lines of the common suf-
  127.               fix.
  128.  
  129.        -i     Ignore  changes in case; consider upper- and lower-
  130.               case letters equivalent.
  131.  
  132.        -I regexp
  133.               Ignore changes that just  insert  or  delete  lines
  134.               that match regexp.
  135.  
  136.        --ifdef=name
  137.               Make merged if-then-else format output, conditional
  138.               on the preprocessor macro name.
  139.  
  140.        --ignore-all-space
  141.               Ignore white space when comparing lines.
  142.  
  143.        --ignore-blank-lines
  144.               Ignore changes that just  insert  or  delete  blank
  145.               lines.
  146.  
  147.        --ignore-case
  148.               Ignore  changes in case; consider upper- and lower-
  149.               case to be the same.
  150.  
  151.        --ignore-matching-lines=regexp
  152.               Ignore changes that just  insert  or  delete  lines
  153.               that match regexp.
  154.  
  155.        --ignore-space-change
  156.               Ignore changes in amount of white space.
  157.  
  158.        --initial-tab
  159.               Output a tab rather than a space before the text of
  160.               a line in normal or context  format.   This  causes
  161.               the alignment of tabs in the line to look normal.
  162.  
  163.        -l     Pass the output through pr to paginate it.
  164.  
  165.        -L label
  166.  
  167.        --label=label
  168.               Use  label  instead of the file name in the context
  169.               format and unified format headers.
  170.  
  171.        --left-column
  172.               Print only the left column of two common  lines  in
  173.               side by side format.
  174.  
  175.        --line-format=format
  176.               Use  format  to  output all input lines in in-then-
  177.               else format.
  178.  
  179.        --minimal
  180.               Change the algorithm to perhaps find a smaller  set
  181.               of changes.  This makes diff slower (sometimes much
  182.               slower).
  183.  
  184.        -n     Output RCS-format diffs; like -f except  that  each
  185.               command specifies the number of lines affected.
  186.  
  187.        -N
  188.        --new-file
  189.               In directory comparison, if a file is found in only
  190.               one directory, treat it as present but empty in the
  191.               other directory.
  192.  
  193.        --new-group-format=format
  194.               Use  format  to  output a group of lines taken from
  195.               just the second file in if-then-else format.
  196.  
  197.        --new-line-format=format
  198.               Use format to output a line  taken  from  just  the
  199.               second file in if-then-else format.
  200.  
  201.        --old-group-format=format
  202.               Use  format  to  output a group of lines taken from
  203.               just the first file in if-then-else format.
  204.  
  205.        --old-line-format=format
  206.               Use format to output a line  taken  from  just  the
  207.               first file in if-then-else format.
  208.  
  209.        -p     Show which C function each change is in.
  210.  
  211.        -P     When  comparing directories, if a file appears only
  212.               in the second directory of the  two,  treat  it  as
  213.               present but empty in the other.
  214.  
  215.        --paginate
  216.               Pass the output through pr to paginate it.
  217.  
  218.        -q     Report  only  whether  the  files  differ,  not the
  219.               details of the differences.
  220.  
  221.        -r     When comparing directories, recursively compare any
  222.               subdirectories found.
  223.  
  224.        --rcs  Output  RCS-format  diffs; like -f except that each
  225.               command specifies the number of lines affected.
  226.  
  227.        --recursive
  228.               When comparing directories, recursively compare any
  229.               subdirectories found.
  230.  
  231.        --report-identical-files
  232.        -s     Report when two files are the same.
  233.  
  234.        -S file
  235.               When  comparing  directories,  start  with the file
  236.               file.  This is used for resuming an aborted compar-
  237.               ison.
  238.  
  239.        --sdiff-merge-assist
  240.               Print  extra information to help sdiff.  sdiff uses
  241.               this option when it runs diff.  This option is  not
  242.               intended for users to use directly.
  243.  
  244.        --show-c-function
  245.               Show which C function each change is in.
  246.  
  247.        --show-function-line=regexp
  248.               In  context  and  unified  format, for each hunk of
  249.               differences, show some of the last  preceding  line
  250.               that matches regexp.
  251.  
  252.        --side-by-side
  253.               Use the side by side output format.
  254.  
  255.        --speed-large-files
  256.               Use  heuristics  to  speed  handling of large files
  257.               that have numerous scattered small changes.
  258.  
  259.        --starting-file=file
  260.               When comparing directories,  start  with  the  file
  261.               file.  This is used for resuming an aborted compar-
  262.               ison.
  263.  
  264.        --suppress-common-lines
  265.               Do not print common lines in side by side format.
  266.  
  267.        -t     Expand tabs to spaces in the  output,  to  preserve
  268.               the alignment of tabs in the input files.
  269.  
  270.        -T     Output a tab rather than a space before the text of
  271.               a line in normal or context  format.   This  causes
  272.               the alignment of tabs in the line to look normal.
  273.  
  274.        --text Treat  all  files as text and compare them line-by-
  275.               line, even if they do not appear to be text.
  276.  
  277.        -u     Use the unified output format.
  278.  
  279.        --unchanged-group-format=format
  280.               Use format to output a group of common lines  taken
  281.               from both files in if-then-else format.
  282.  
  283.        --unchanged-line-format=format
  284.               Use format to output a line common to both files in
  285.               if-then-else format.
  286.  
  287.        --unidirectional-new-file
  288.               When comparing directories, if a file appears  only
  289.               in  the  second  directory  of the two, treat it as
  290.               present but empty in the other.
  291.  
  292.        -U lines
  293.        --unified[=lines]
  294.               Use the unified output format,  showing  lines  (an
  295.               integer) lines of context, or three if lines is not
  296.               given.  For proper operation, patch typically needs
  297.               at least two lines of context.
  298.  
  299.        -v
  300.        --version
  301.               Output the version number of diff.
  302.  
  303.        -w     Ignore white space when comparing lines.
  304.  
  305.        -W columns
  306.        --width=columns
  307.               Use an output width of columns in side by side for-
  308.               mat.
  309.  
  310.        -x pattern
  311.               When comparing directories, ignore files and subdi-
  312.               rectories whose basenames match pattern.
  313.  
  314.        -X file
  315.               When comparing directories, ignore files and subdi-
  316.               rectories whose basenames match  any  pattern  con-
  317.               tained in file.
  318.  
  319.        -y     Use the side by side output format.
  320.  
  321.  
  322.  
  323. SEE ALSO
  324.        cmp(1),   comm(1),   diff3(1),   ed(1),  patch(1),  pr(1),
  325.        sdiff(1).
  326.  
  327.  
  328.  
  329. DIAGNOSTICS
  330.        An exit status of 0 means no  differences  were  found,  1
  331.        means some differences were found, and 2 means trouble.

Raw Paste


Login or Register to edit or fork this paste. It's free.