how to gzip tar code example

Example 1: gzip folder with tar

# gzip my-folder-name
#
# flags:
# 	z = filter the archive through gzip
# 	c = create a new archive
# 	v = verbosely list files processed
# 	f = use archive file or device ARCHIVE
#
# Example:
tar -zcvf my-filename.tar.gz my-folder-name

Example 2: how to extract tar.gz

If your tar file is compressed using a gzip compressor, use the following command to extract it.

    $ tar xvzf file.tar.gz
    
If your tar file is compressed using a bZip2 compressor, use the following command to extract it.

    $ tar xvjf file.tar.bz2