Alex
Alex

Reputation: 44345

How to compare two tar archives (including file content, new/removed files, symlinks)?

I have two tar archives (compressed or not compressed), and I want to find all differences in the two archives. Both archives contain a complete file system (i.e. when unpacked, would generate directories like /bin, /home, /root, /usr, /var, /etc,... I hope you get the point). I want to have a list of the following:

I cannot just unpack those archives and use diff, as diff will not correctly recognize absolute symlinks (as they would point out of the file system structure of the archive).

Is there another way to compare the content of two tar archives?

Upvotes: 4

Views: 6034

Answers (1)

Nathan Fellman
Nathan Fellman

Reputation: 127488

The best I can think of is to use:

tar -tvf archive.tar

to list the contents of the file.

Something like:

tar -tvf archive1.tar > list1
tar -tvf archive2.tar > list2
diff list1 list2

Upvotes: 5

Related Questions