Skip to content
Search

Diff

lastmod 2026-03-15created 2014-09-2913 edits

In computing, diff is a file comparison utility that outputs information about the differences between two files. It is generally used to show the changes between one version of a file and another version of the same file. diff shows changes between lines of document files. A file created with this command can be used with the patch command, a Unix-family program, to produce output.

Options

-u
Output in Unified Format.
-r
Search subdirectories recursively as well.
-N
Include new files in the Diff as well.

Example

Output the changes between two folders as a diff file in Unified Format.

$ diff -urN [원본폴더] [변경폴더] > [DIFF파일명]

Compare two directories.

$ diff -rq dir1 dir2 | sort

Binary diff

Binary comparison: (used together with xxd)

$ diff -y <(xxd foo1.bin) <(xxd foo2.bin)

You can also use colordiff:

$ colordiff -y <(xxd foo1.bin) <(xxd foo2.bin)

Text Processing Commands

List of text processing commands

Text

Common

grep, sed, awk, cat, xargs, rev, tee, ack, tr, stdbuf, split

Diff

diff, patch

Cutting

cut, head, tail, less, more, split, watch

Sort

uniq, sort

Hash

base64, md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum

Clipboard

clip (Windows), pbcopy (Mac OSX), pbpaste (Mac OSX), xclip (Debian)

E.T.C

regexp, parallel

See also

  • odiff
  • imgdiff
  • fclones - Efficient duplicate file finder
  • DiffX – Next-generation extensible Diff format
  • BlazeDiff - Ultra-fast image comparison library
  • 0github - Heatmap-based Diff viewer for code review
  • deff - Interactive git diff TUI viewer
  • diffnav - GitHub-style Git diff pager

Favorite site

author Zer0 sitemap