Avatar of ashsysad
ashsysad
Flag for United States of America asked on

Comparing file-system between 2 Linux machines

Hello,

I have a requirement to compare the folders between 2 Linux Systems. Is that possible ?
Basically I want to check the missing files and the list of files for which the content differs.
I'm aware of using 'diff' command to compare 2 Folders Locally, but wondering how can I do it across remote systems. Please advise.  Thankyou.

An illustration of using 'diff' command in local filesystems:

[root@hostxyz folder1]# ls -l
total 16
-rw-r--r-- 1 root root 3 Sep 24 12:29 oraclelinux
-rw-r--r-- 1 root root 3 Sep 24 12:28 redhat
-rw-r--r-- 1 root root 3 Sep 24 12:28 suse
-rw-r--r-- 1 root root 3 Sep 24 12:29 ubuntu
[root@hostxyz folder1]# for i in `ls`; do echo $i   : `cat $i`; done      # Contents of files in folder1
oraclelinux : OS
redhat : OS
suse : OS
ubuntu : OS
[root@hostxyz folder1]# cd ../folder2
[root@hostxyz folder2]# ls -l
total 16
-rw-r--r-- 1 root root 17 Sep 24 12:34 CentOS
-rw-r--r-- 1 root root 17 Sep 24 12:30 oraclelinux
-rw-r--r-- 1 root root  3 Sep 24 12:29 redhat
-rw-r--r-- 1 root root 17 Sep 24 12:30 ubuntu
[root@hostxyz folder2]# for i in `ls`; do echo $i   : `cat $i`; done     # Contents of files in folder2
CentOS : Operatins system
oraclelinux : Operating system
redhat : OS
ubuntu : Operating system

[root@hostxyz folder2]# diff /var/folder1 /var/folder2 -r --brief    
Only in /var/folder2: CentOS
Files /var/folder1/oraclelinux and /var/folder2/oraclelinux differ
Only in /var/folder1: suse
Files /var/folder1/ubuntu and /var/folder2/ubuntu differ
[root@hostxyz folder2]#

Options used :
 -r  :      Searched recursively through the directories.
--brief : Only shows the names of the files that differ. If you want details of the content that differs, remove this option.
LinuxLinux DistributionsLinux Networking

Avatar of undefined
Last Comment
ashsysad

8/22/2022 - Mon
SOLUTION
xstenuit

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ashsysad

ASKER
Thanks xstenuit,  Let me try this tomorrow and update you the status.
ASKER CERTIFIED SOLUTION
remeshk

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ashsysad

ASKER
Hello remeshk,  

This is really a wonderful solution and this is what exactly I was looking for. I just tested and works like a charm. Thankyou so much !!!!!

@xstenuit, Thanks for your solution as well.

Have a great day !
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23