Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have crontab event archives to .tar.gz some folder every N hours. Finally I have collection of .tar.gz files. Now I want remove duplicating archives (created while target files stays unchanged) How can I do that.

I tried to perform comparison by checking hashsum, but tar.gz archives always has different sum:

altera@nuclight:~$ rm -rf *
altera@nuclight:~$ echo "Hello world" > file
altera@nuclight:~$ tar czf a1.tgz file
altera@nuclight:~$ tar czf a2.tgz file
altera@nuclight:~$ tar czf a3.tgz file
altera@nuclight:~$ tar czf a4.tgz file
altera@nuclight:~$ tar czf a5.tgz file
altera@nuclight:~$ ls
a1.tgz  a2.tgz  a3.tgz  a4.tgz  a5.tgz  file
altera@nuclight:~$ md5sum *.tgz
e8587f4c381856af9278a6ef2a452b00  a1.tgz
2f44617fb164e66a74c5c4992637e7d4  a2.tgz
1a094b315e2d0891a0c5dafebae9718f  a3.tgz
6c3642d2441397c24e4de5377b9e0a7e  a4.tgz
7c0e9128ef47a9dbcda0dd008e34cd8d  a5.tgz
share|improve this question

If your source files are completely untouched, running a hash/checksum on your archives should produce the same results for unchanged files. Then simply delete files with duplicate hashes.

share|improve this answer
Already tried, post edited – atomAltera Mar 3 '13 at 7:37
If the MD5 hash changes, then the contents of the files are not identical, so maybe what you need to do is work out what is changing in the archives ? – davidgo Mar 3 '13 at 7:45
Perhaps try --atime-preserve tar option? – Mxx Mar 3 '13 at 7:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.