-   Linux - Server (
-   -   Compare directory trees on seperate servers ? (

dhg1848 11-25-2008 04:37 PM

Compare directory trees on seperate servers ?
Hello all,

I have two servers with "similar" OS loads on them. One server is production the other is test. I wish to compare the differences in the directory structure/file systems for the two.

Can anyone help w/ a simple 'diff' type command for server A and server B? An added note, these servers, unfortunately are on different networks and cannot talk to one-another.

I am a bit of a newb to the land of Linux so I apologize for the potential simplicity of this thread.

Kind Regards and Thanks ahead of time!

BTW...SuSE 10 is the OS on both.

ilikejam 11-25-2008 06:41 PM


I'm sure there's a few ways to do this but here's how I'd go about it.

Let's say you want to compare the /usr filesystems (if you want the whole system, replace /usr with /) on hosts a and b .
On a: # find /usr | sort > filesystem.out.a
On b: # find /usr | sort > filesystem.out.b

Then get the filesystem.out.X files onto one machine, and run:
# diff filesystem.out.a filesystem.out.b

If the output is a bit big, try 'diff -d'. You should get a smaller output, but it may take a bit longer.


rahulk 11-25-2008 08:24 PM

As already replied by Dave, diff would work for you. Since you are using linux, better use "locate" command to get the listing, it would be amazingly fast.

Here is what you need to do:-

1. On both servers (I assume its Linux), run "updatedb". This will build an internal slocate database for "locate" command.
2. Run the command and grep for the filesystem you wish to compare:-

locate etc > filenameA
3. Afterwards just do the diff as suggested earlier.

Best Regards,

ilikejam 11-26-2008 05:27 AM

Using 'locate' would be faster, but running 'updatedb' first, then 'locate' would likely not be so fast.


dhg1848 11-26-2008 08:47 AM

Thanks for all the responses guys! I'm sure you'll be hearing from me quite a bit more in the near future. Have a great Holiday.

All times are GMT -5. The time now is 04:43 PM.