TAR ball

Creating

tar -czf <tarball.tar.gz> [file1 file2|directory]

Options:

  • -c option - Create a file.
  • -z option - GZip the file.
  • -f option - Specifying where to save it (as oppose to stdout).

May also use:

  • -j option - For BZip2 (.bz2) as oppose to GZip.

Extracting

tar -xzf <tarball.tar.gz> [<exact file you want>]

(The last parameter is optional---if left out, all files will be extracted)

Options:

  • -x option - Decompress file.
  • -z option - UnGZip the file first.
  • -f option - Specifying what file to decompress (as oppose to stdin).

May also use:

  • -j option - For BZip2 (.bz2) as oppose to GZip.

Listing contents

tar -ztf <tarball.tar.gz>

Options:

  • -z option - Specifies that it's a GZip tar ball.
  • -t option - List contents of archive.
  • -f option - Specifying what file to decompress (as oppose to stdin).

May also use:

  • -j option - For BZip2 tarballs (.bz2) as oppose to GZip.