Operations 4 min read

How to Spot Differences Between Two Linux Directories Using diff and Meld

Learn step-by-step how to compare two Linux directories, using the diff command with options like -q and -r to list unique files, and visualize results with the graphical Meld tool, including installation instructions for various distributions and screenshots of the comparison workflow.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Spot Differences Between Two Linux Directories Using diff and Meld

In this guide we explain how to find differences between two directories on a Linux system.

Using the diff command

The basic syntax is: diff [OPTION]… FILES To compare two directories you can run: diff -q dir1 dir2 The -q switch reports only when files differ, producing output such as: diff -q www.linuxmi.com/ linuxmi.com/ Result example:

Only in www.linuxmi.com/: Blender 2.blend
Only in www.linuxmi.com/: Windows 10 vs Debian vs Arch Linux (EndeavourOS) - Speed Test!-cQWwb8VRrhU.mkv

By default diff does not descend into sub‑directories. Adding the -r flag enables recursive comparison:

diff -qr www.linuxmi.com/ linuxmi.com/

Visual comparison with Meld

Meld is a graphical diff and merge tool for GNOME desktops. Install it with the package manager of your distribution: sudo apt install meld (Debian/Ubuntu) sudo yum install meld (RHEL/CentOS) sudo dnf install meld (Fedora 22+)

After installation, launch Meld from the desktop menu (e.g., Ubuntu Dash, Linux Mint menu, or Fedora Activities Overview). In Meld, select “Directory Comparison”, choose the two directories, optionally enable “3‑way comparison”, and click “Compare”.

Meld directory comparison UI
Meld directory comparison UI

The interface shows files unique to each directory and differences within common files, allowing you to inspect and merge changes visually.

Conclusion

This article covered command‑line methods ( diff -q and diff -qr) for listing differing files between directories, and a graphical alternative using Meld, with installation steps for major Linux distributions and screenshots illustrating the workflow.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxcommand-linediffdirectory comparisonMeld
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.