📄 help
字号:
Compare Files or Directories, Release 2.1.j
Usage: diff [-bBefhiqrvw!-] [-m minmatch] [-Dstring] oldpath newpath
diff produces a list of differences between two files or
directories. The working assumption is that newpath is a
newer version of whatever's in oldpath. If they're files,
diff assumes they contain ascii text but if it encounters a
file containing lots of binary data, it switches to a binary
comparison mode to avoid dumping gibberish to the screen.
Comparing files, diff looks for minimal sections of change.
Each difference is shown as an add, delete or change with the
appropriate line numbers or line number ranges for each file.
Following are texts of the differing section. Lines that have
been deleted are flagged with '<'; lines that have been added
are flagged with '>'. Alternately, diff can be used to produce
merged listings with #ifdefs for the C compiler or highlighting
for quick visual scanning.
Comparing directories, the lists of files they contain all the
way down through the tree are sorted, then compared. If the
same filename exists in each directory tree, a quick binary
comparison is normally made to give a quick yes-or-no are they
different. If -r is specified, the diff text comparison is
done recursively the whole way down the two trees.
If one of the arguments to diff is a file and the other is a
directory, diff will look for and compare against a file of
the same name in the directory.
Options:
-b Blank spaces of any length compare equal. Ignore
any leading or trailing white space on each line.
-B Binary comparison even on text files.
-Dstring Produce a merged #ifdef'ed listing, with the string
being defined meaning use the older version. (Newer
version is intentionally the default.)
-e Turn off highlighting of empty lines. By default,
if highlighting is used to show areas of change,
even empty lines will have Ansi sequences at the
beginning and end so that if more is used to display
the output with the default color stretch mode on,
empty lines will still be highlighted.
-f Force diff-style comparison to continue even on files
that appear to contain binary data.
-h Help. (This screen.)
-i Ignore character case.
-m minmatch Minimum match length to insist on before resynchro-
nizing two files. (Default is 2 lines.)
-q Quiet: suppress warnings about files containing
binary data.
-r Recursively diff the contents of any subdirectories.
-v Verbose listing of all the contents of any entire
subdirectory added or deleted.
-w White space is ignored totally.
-! Produce merged, highlighted version. Text that's
unchanged is normal, deleted text is red, new text
is green.
-- End of options.
Colors:
You may set your own choices for screen colors using these
environmental variables:
Name Use Default
COLORS Normal screen colors White on Black
ADDITIONS Lines added Bright Green
DELETIONS Lines deleted Bright Red
Colors recognized are black, red, green, yellow, blue, magenta
(or red blue), cyan (or blue green) or white. Foreground colors
may also be bright or blink. The names of the colors and the
words bright, blink and on may be in either upper or lower or
mixed case but the names of the environmental variables themselves
must be all upper case.
Either or both the foreground and background colors may be
specified; if you don't specify a value, it's considered
transparent and inherits the color underneath it. ADDITIONS
and DELETIONS inherit from COLORS.
Copyright (c) 1990-1993 by Hamilton Laboratories. All rights reserved.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -