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.
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.mkvBy 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”.
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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
