Mint

How to Compare the Difference of Two Directories in Linux Mint 21?

“Directories in Linux or any other operating system provide a very nice way to organize your files. Most people like to create a directory of all similar files. However, you might sometimes have two directories with pretty much similar content. In this situation, it gets a bit difficult to differentiate between these directories. In this guide, we will discuss the method of comparing the difference of two directories in Linux Mint 21.”

Method of Comparing the Difference of Two Directories in Linux Mint 21

To compare the difference of two directories on a Linux Mint 21 system, you have to perform the following steps:

Method # 1: Visualize the Two Target Directories

First, we would like to show you the two directories we will compare in this method. For displaying the structure of the first directory, we will execute the command shown below:

$ ls –lR /home/system/Dir1

The contents of our first directory are shown in the following image:

To display the contents of the second directory, we have to run the command shown below:

$ ls –lR /home/system/Dir2

The contents of our second directory are shown in the following image:

Method # 2: Compare the Difference of the Two Target Directories

Now, to compare the difference of these two directories, we will use the command shown below:

$ diff --brief --recursive Dir1 Dir2

The differences of our two directories are stated in the following image:

Conclusion

With the help of the above method, you can easily compare any two directories of your choice from your Linux Mint 21 system. In this way, you will quickly be able to figure out all the differences between these two directories.

Similar Posts