How to compare two tarball's content

后端 未结 11 825
北海茫月
北海茫月 2021-01-31 15:18

I want to tell whether two tarball files contain identical files, in terms of file name and file content, not including meta-data like date, user, group.

However, There

11条回答
  •  离开以前
    2021-01-31 16:08

    EDIT: See the comment by @StéphaneGourichon

    I realise that this is a late reply, but I came across the thread whilst attempting to achieve the same thing. The solution that I've implemented outputs the tar to stdout, and pipes it to whichever hash you choose:

    tar -xOzf archive.tar.gz | sort | sha1sum
    

    Note that the order of the arguments is important; particularly O which signals to use stdout.

提交回复
热议问题