Ganesan MP
Ganesan MP

Reputation: 397

Difference between two .tar.gz file lists on linux

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

Upvotes: 27

Views: 22852

Answers (1)

P.P
P.P

Reputation: 121397

Just list the contents and do diff:

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

Upvotes: 46

Related Questions