When you write:
tar -xf *.gz
the tar
command sees (for example):
tar -xf abc.tar.gz def.tar.gz ghi.tar.gz
This is interpreted as a request to extract def.tar.gz
and ghi.tar.gz
from the archive abc.tar.gz
. Since the files aren't in there, you get the warning message.
In other words, tar
operates on a single tar
file (possibly compressed) at a time (in one invocation). It does not operate on multiple tar files.
Note that if abc.tar.gz
contains a file pqr/xyz/important.c
, you can extract just the one file by specifying:
tar -xf abc.tar.gz pqr/xyz/important.c
The notation you used is only a variant on this notation.
(And yes, there can be reasons to tar
a tar
file. For example, Gmail does not allow you to ship a tar file or a gzipped tar file which contains a file that is executable. However, if you embed a gzipped tar file inside a non-compressed tar file, it does not look inside the inner file to find the executable file. I use this when I need to ship a tar file with an executable configure
script.)