You may use diff's --compare (-diff, d) option.
You have to take some care because diff compares only files specified on the command line, and only those that simultaneously exist inside the archive. For example, new existing files are not reported.
Often I prefer the approach of pix to take more control.
However, unlike pix and Michael Soegtrop, I do not think you have to extract any file.
The following code test diff's ability to compare files.
touch refF; setTM12 () { touch -r refF F1 F2; };
# create the files
echo a1a > F1; echo a2a > F2; echo a3a>F3; echo a4a>F4; setTM12;
tar cf tarF F1 F2 F3 F4;
# do not change times of F1 F2
# modify F1 F2 F3, change the mtime of F4
echo mod > F1; echo longer > F2; setTM12;
sleep 2; echo XXX > F3; touch F4;
tar -df tarF F1 F2 F3 F4
F1: Contents differ
F2: Size differs
F3: Mod time differs
F3: Contents differ
F4: Mod time differs
You may need to know that Size differs
implicitly tags files whose contents differs, for example F2
.
-v
is handy option, two.
tar -vdf tarF F1 F2 F3 F4
F1
F1: Contents differ
F2
F2: Size differs <--- Means that the Contents differ, too !
F3
F3: Mod time differs
F3: Contents differ
F4
F4: Mod time differs