Having two different .tar.gz files: The second .tar.gz is the subset of first .tar.gz.
I need a single line command to find the missing files in second .tar.gz.
E.g.:
1.tar.gz file list:
1.jsp
2.txt
3.htm
2.tar.gz file list:
1.jsp
3.htm
output should be:
2.txt
execute a tar tvf to list the contents of each file and store the outputs in two different files. then, slice out everything besides the filename and size columns. Preferably sort the two files too. Then, just do a file diff between the two lists.
In short, a TAR file creates one archive file out of multiple files without compressing them, while the GZ file format compresses a file without creating an archive. Combined into the tar GZ file extension, you can archive and compress multiple files into one.
Introduction: A tarball (or tar.gz or tar.bz2) is nothing but a computer file format that combines and compresses multiple files. Tarballs are common file format on a Linux or Unix-like operating systems. Tarballs are often used for distribution of software/media or backup purposes.
Just list the contents and do diff
:
diff <(tar -tvf 1.tar.gz | sort) <(tar -tvf 2.tar.gz | sort)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With