extract file from tar.gz in current directory code example
Example 1: extract from tar gz into folder
mkdir foo
tar -xzf bar.tar.gz -C foo
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