untar a tar.gz file to a directory code example
Example 1: extract from tar gz into folder
mkdir foo
tar -xzf bar.tar.gz -C foo
Example 2: how to unzip using tar
tar -xf archive.tar.gz
mkdir foo
tar -xzf bar.tar.gz -C foo
tar -xf archive.tar.gz