Intermediate Package: diffutils

diff

Compare two files line by line.

Syntax

diff [options] file1 file2

Description

diff shows the differences between two files (or, with -r, two directory trees), in a compact format showing which lines were added, removed or changed — the basis of tools like patch and most version control systems.

Examples

diff old.conf new.conf
Show line-by-line differences between two files
diff -u old.conf new.conf
Show output in the common "unified diff" format
diff -r dir1/ dir2/
Recursively compare two directory trees

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux