how to extract a tar gz file to a directory in linux code example
Example 1: create tar gz file from directory
tar -czf tarball.tar.gz my_directory/
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