Wtf?
you might reasonably exclaim, unless you’re used to using *nix (Linux, UNIX, etc) from the command line.
tar is a command for moving a file or files into a single archive
file (or for reversing the operation). It can also apply compression/decompression algorithms, and perform various other neat tricks. It’s useful and ubiquitous. Unfortunately, it’s also quite sensitive.
Just now, I was using tar -cfz mytarfile.tar.gz mydirectory to archive a directory, and this returned the error, tar: mytarfile.tar.gz: Cannot stat: No such file or directory. Hmm, not good.
tar: Error exit delayed from previous errors
Easy to fix, though. The solution to the problem is this: I should have written, tar -czf mytarfile.tar.gz mydirectory. In other words, the z and the f get swapped in the options. This is because the f option is supposed to denote that what follows it is a file. So the first command I tried was looking for a file called mytarfile.tar.gz
to add to an archive file called z
. Since the mytarfile.tar.gz
didn’t exist, tar couldn’t locate, or stat
, the file. Hence the error.
Oh, what fun is to be had at the command line!
Thanks! you saved my day! I searched many forums and found no good answer until this.
Thanks for this post! It helped me with an issue I was having. I was trying to use: tar -czfv but I guess tar didn’t like the “v”
Thanks heaps! I was trying to backup my htdocs and i ran into the same problem. This page was really helpful to fix it.. cheers..
Thanks for posting this!
Thanks. Amazingly, GNU’s own manual flagrantly ignores this:
http://www.gnu.org/software/tar/manual/tar.html#SEC127
“Wtf?” I might reasonably exclaim to their face.
This is why I “cannot stat” the command line.
Thanks!
And Erik, the v needs to be before the f as well
Ugh… some days. Thanks! This had me completely frazzled.