A tgz file is a compressed archive of directories and/or files that is prepared by tarring a directory, and then gzipping the resulting .tar file.

In Linux itīs used:

  • To pack the command
    • Simple tar file: tar-cf tarredfilename filetopack1 filetopack2 and so on...
    • to pack and compress:
      tar-czf tarredfilename filetopack1 filetopack2 and so on...to compress in gzip
      and tar-cjf tarredfilename filetopack1 filetopack2 and so on...to compress in bzip2 file format.
  • To unpack tar files
    • and uncompress gziped files, the command tar -xzf filetounpack.tar.gz
    • and uncompress bzip2ed files, tar -xjf filetounpack.tar.gz.bz2