![](/img/trans.png)
[英]how to compare two tar files's content using diff command if file name is passed as variable
[英]How to compare two tar archives (including file content, new/removed files, symlinks)?
我有两个tar档案(压缩或未压缩),我想找到两个档案中的所有差异。 这两个档案都包含一个完整的文件系统(即解压缩后,会生成目录,如/bin
, /home
, /root
, /usr
, /var
, /etc
,......我希望你明白这一点)。 我想要一个以下列表:
我不能只解压缩这些档案并使用diff
,因为diff无法正确识别绝对符号链接(因为它们会指出档案的文件系统结构)。
有没有其他方法来比较两个tar档案的内容?
我能想到的最好的就是使用:
tar -tvf archive.tar
列出文件的内容。
就像是:
tar -tvf archive1.tar > list1
tar -tvf archive2.tar > list2
diff list1 list2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.