When you create a .tar.gz file, you usually want to compress an entire folder. This can be done with a simple command using tar with gzip compression.
Let’s assume your folder is named
folder. Type following command in terminal:
$ tar -zcvf folder.tar.gz folder/
zuses gzip as a compression method to the tar archive
ccreates a new archive file
fwe enter the new filename for the archive after this parameter
To verify that the contents of the newly created folder.tar.gz, you can enter:
$ tar -tf folder.tar.gz
This should output the contents of the folder.