LinuxCommandLibrary

diffoscope

Compare differences between files, directories, or archives

TLDR

Compare two files

$ diffoscope [path/to/file1] [path/to/file2]
copy

Compare two files without displaying a progress bar
$ diffoscope --no-progress [path/to/file1] [path/to/file2]
copy

Compare two files and write an HTML-report to a file (use - for stdout)
$ diffoscope --html [path/to/outfile|-] [path/to/file1] [path/to/file2]
copy

Compare two directories excluding files with a name matching a specified pattern
$ diffoscope --exclude [pattern] [path/to/directory1] [path/to/directory2]
copy

Compare two directories and control whether directory metadata is considered
$ diffoscope --exclude-directory-metadata [auto|yes|no|recursive] [path/to/directory1] [path/to/directory2]
copy

SYNOPSIS

diffoscope [OPTION]... file1 file2

PARAMETERS

-h, --help
    show this help message and exit

--version
    show program's version number and exit

--list-tools
    list external tools used by diffoscope

--html[=FILE]
    write HTML report to FILE (default: diffoscope.html)

--html-title=TITLE
    set HTML title

--css=URL
    set CSS URL in HTML report

--new-file=NAME
    use NAME as label for first file

--old-file=NAME
    use NAME as label for second file

--ignore=METADATA
    ignore specific metadata differences (e.g. timestamp,overlay)

--max-diff-block-lines=LINES
    truncate unified diffs longer than LINES

--max-report-size=SIZE
    truncate report if larger than SIZE bytes

--no-report-size-limit
    do not limit report size

--unicode
    use Unicode line-drawing characters

--verbosity=LEVEL
    verbosity level (0-3)

--profile=PROFILE
    enable profiling (wall-clock or cpu-clock)

DESCRIPTION

diffoscope is a powerful tool for comparing files, directories, and archives byte-by-byte and in human-readable form. Unlike diff(1), it dissects structured files like ELF binaries, tarballs, PDFs, images, and more using external helpers (e.g., binutils, pdftohtml, squashfs-tools). It generates detailed reports showing differences in metadata, contents, and subcomponents.

Ideal for reproducible builds verification in Debian and other distros, debugging container images, or spotting subtle changes in firmware. Output formats include text, HTML, JSON, and side-by-side diffs. It handles symlinks, devices, FIFOs via emulation and supports exclusions for noise reduction.

CAVEATS

Requires many external tools for full functionality; install via package manager. Resource-intensive on large files/directories. Some formats need root for devices/FIFOs.

INSTALLATION

Available in most distros: apt install diffoscope, dnf install diffoscope. Or pip install diffoscope.

HELPERS

Run diffoscope --list-tools to see required tools; auto-detects most.

HISTORY

Developed since 2014 by Chris Lamb for Debian Reproducible Builds effort. Now maintained by Reproducible Builds project, supports 100+ formats, Python-based with active upstream.

SEE ALSO

diff(1), cmp(1), vbindiff(1), xxd(1), binwalk(1)

Copied to clipboard