Debian 9.3 - untar fails saying the file doesn't exist

You got caught in a trap. tar supports two formats of command line options, the usual one with a dash, and the legacy format without one. And they differ with regard to argument handling.

Here:

tar -xzfv maldetect-current.tar.gz

the argument for -f is v, as in about all other tools.

On the other hand, here:

tar xzfv maldetect-current.tar.gz

the argument to f is taken from the next command line argument, the filename you actually wanted to give.

The error message mentions the filename it tried to access, you might just have missed it since v is rather short. Usually the file in question is listed in error messages, though.

The GNU tar man page mentions this under "Option styles":

In traditional style, the first argument is a cluster of option letters and all subsequent arguments supply arguments to those options that require them.

In UNIX or short-option style, each option letter is prefixed with a single dash, as in other command line utilities. If an option takes argument, the argument follows it, either as a separate command line word, or immediately following the option.


The filename should follow immediately after the f option.

tar -xzvf maldetect-current.tar.gz

Tags:

Debian

Tar

Files