When you write
tar -xzf *.gz
your shell expands it to the string:
tar -xzf 1.gz 2.gz 3.gz
(assuming 1.gz, 2.gz and 3.gz are in you current directory).
tar
thinks that you want to extract 2.gz
and 3.gz
from 1.gz
; it can’t find these files in the archives and that causes the error message.
You need to use loop for
of command xargs
to extract your files.
ls *.gz |xargs -n1 tar -xzf
That means: run me tar -xzf
for every gz
-file in the current directory.