extract tar.gz to a folder code example Example 1: extract from tar gz into folder mkdir foo tar -xzf bar.tar.gz -C foo Example 2: extract tar.gz tar -xf archive.tar.gz