Difference between two .tar.gz file lists on linux

linux, tar

Solution

Just list the contents and do `diff`:

diff <(tar -tvf 1.tar.gz | sort) <(tar -tvf 2.tar.gz | sort)

Problem

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 ```

Original source