In order to compress an entire folder with Gzip, you first need to create a tar file which you can compress with gzip. Fortunately this can be accomplished with a single one-liner command.
Let’s assume your folder is named my-folder
. Type following command in terminal:
$ tar -zcvf my-folder.tar.gz my-folder/
z
uses gzip as a compression method to the tar archivec
creates a new archive filev
verbose outputf
we enter the new filename for the archive after this parameterTo check the contents of the newly created my-folder.tar.gz, you can enter:
$ tar -tf my-folder.tar.gz
This should output your folder contents.