In an earlier article, we reviewed 9 finest file comparability and distinction (Diff) instruments for Linux and on this article, we are going to describe discover the distinction between two directories in Linux.
Usually, to examine two information in Linux, we use the diff – a easy and authentic Unix command-line device that reveals you the distinction between two laptop information; compares information line by line and it’s straightforward to make use of, comes with pre-installed on most if not all Linux distributions.
The query is how can we get the distinction between two directories in Linux? Right here, we need to know what information/subdirectories are widespread within the two directories, these which might be current in a single listing however not within the different.
The standard syntax for operating diff is as follows:
$ diff [OPTION]… FILES $ diff choices dir1 dir2
By default, its output is ordered alphabetically by file/subdirectory identify as proven within the screenshot beneath. On this command, the -q
change tells diff to report solely when information differ.
$ diff -q directory-1/ directory-2/

Once more diff doesn’t go into the subdirectories, however we are able to use the -r
change to learn the subdirectories as effectively like this.
$ diff -qr directory-1/ directory-2/
Utilizing Meld Visible Diff and Merge Device
There’s a cool graphical possibility known as meld (a visible diff and merge device for the GNOME Desktop) for individuals who take pleasure in utilizing the mouse, you possibly can set up it as follows.
$ sudo apt set up meld [On Debian, Ubuntu and Mint] $ sudo yum set up meld [On RHEL/CentOS/Fedora and Rocky/AlmaLinux] $ sudo emerge -a sys-apps/meld [On Gentoo Linux] $ sudo apk add meld [On Alpine Linux] $ sudo pacman -S meld [On Arch Linux] $ sudo zypper set up meld [On OpenSUSE] $ sudo brew set up meld [On macOS]
Upon getting put in it, seek for “meld” within the Ubuntu Sprint or Linux Mint Menu, in Actions Overview on Fedora or CentOS desktop and launch it.
You will note the Meld interface beneath, the place you possibly can select file or listing comparability in addition to a model management view. Click on on listing comparability and transfer to the following interface.

Choose the directories you need to examine, be aware which you can add a 3rd listing by checking the choice “3-way Comparability”.

As soon as you chose the directories, click on on “Examine”.

On this article, we described discover the distinction between two directories in Linux. If you recognize some other command line or gui method don’t neglect to share your ideas to this text by way of the remark part beneath.