Compress a folder with tar
To archive and compress a folder with tar use this command:
$ tar -czvf folder.tar.gz folder
Be careful with the parameters order: tar -czvf is not the same as tar -cvfz. The fist one is ok, but the second one ends with an error:
$ tar -cvfz folder.tar.gz folder tar: folder.tar.gz: Cannot stat: No such file or directory folder/ folder/file1.txt folder/file2.txt folder/file3.txt tar: Exiting with failure status due to previous errors
An ls will show a z file. The reason is that the -f parameter takes the next argument as the filename to archive, thus the z file in our folder. So you have to use the tar -czvf syntax.