Context
While trying to run the following tar command
tar -vcfz filename.tar.gz filename.sql
I got this error
tar: filename.tar.gz: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
Solution
The problem with the command above, is that the -f option has to be the last one in the sequence of options, otherwise it assumes that the next option (in this example z) is the file argument.
Then, the right way to write the command would be:
tar -vczf filename.tar.gz filename.sql