tar -xvfz foo.tar.gz
returns an error tar: z: Cannot open: No such file or directory
This is completely understandable - the f
switch expects a filename, and so needs to be last.
However, omitting the hyphen tar xvfz foot.tar.gz
works and uncompresses and untars the file.
I've tested this on OS X 10.8 and Ubuntu 12.04.
Any ideas why?
[edited to add]
I always use tar -zxvf foo.tar.gz
. However, this question has arisen because of this xkcd, and my surprise when someone insisted that tar xvfz
would work.