Updated: 28 September 2026 · Applies to: GNU diffutils 3.7 and later and Meld 3.22 on AlmaLinux and Rocky Linux 9 and 10, Ubuntu 24.04 and 26.04, Debian 13, Fedora 44

To see how two folders differ, for example a backup and the live site, or two releases of an application, use diff on the command line or Meld on a desktop. diff is installed on every Linux server; Meld needs a graphical desktop. We tested the commands below on AlmaLinux 10 and Debian 13.

1. Which files differ (diff)

diff -rq /var/www/site /root/backup/site

-r compares all subfolders and -q only names the files instead of printing every changed line. The output looks like this:

Files /var/www/site/config.php and /root/backup/site/config.php differ
Only in /var/www/site/uploads: new-image.jpg
Only in /root/backup/site: old-plugin

2. What changed inside the files

diff -ru /root/backup/site /var/www/site > site-changes.diff

-u gives the unified format: lines starting with - were removed, lines starting with + were added, with three lines of context around each change. Open the result with less site-changes.diff.

Useful options

  • -N: also show the full content of files that exist on only one side.
  • --exclude=cache or -x '*.log': skip folders or files that always differ. Repeat for several patterns.
  • -w: ignore changes in spaces and tabs; -B: ignore blank lines.
  • --color=auto: colour the output in the terminal.

Quick check without reading the content

To know only whether anything changed, compare checksums. This is also useful across two servers:

cd /var/www/site && find . -type f -exec sha256sum {} + | sort -k 2 > /tmp/live.sha
cd /root/backup/site && find . -type f -exec sha256sum {} + | sort -k 2 > /tmp/backup.sha
diff /tmp/backup.sha /tmp/live.sha

For a dry run of what rsync would copy, rsync -rcn --delete --itemize-changes /root/backup/site/ /var/www/site/ lists the differences without changing anything. Keep the -n: without it, rsync would make the live folder match the backup and delete the extra files.

3. Meld: compare folders side by side

Meld is a graphical compare and merge tool for Linux desktops. Install it:

apt install meld                               # Ubuntu, Debian
dnf install meld                               # Fedora
dnf install epel-release && dnf install meld   # AlmaLinux, Rocky Linux (from EPEL)

Start it with two (or three) folders:

meld /root/backup/site /var/www/site

Meld shows both trees next to each other and marks new, missing and changed files in colour. Double-click a file to see its changes line by line and copy changes from one side to the other with the arrows. To compare folders on a remote server, copy them to your computer first, or mount the server's folder with sshfs.

Official documentation: GNU diffutils manual and Meld.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket