By: Erik Solis | Published: 09/02/2023 @ 11:30 PM EST

Objective: Learn how to create and extract tar.gzip files

Topics Covered:

  1. Creating a Tarball
  2. Extracting a Tarball

What is a tarball file?

The “.tar.gz” format combines two types of compression. First, the “.tar” extension stands for “tape archive,” which bundles multiple files and directories into a single archive file without compressing them. Then, the “.gz” extension represents the “gzip” compression, which is applied to the “.tar” archive to reduce its size. This two-step process creates a compressed archive that retains the file structure while reducing overall size. It’s commonly used in Unix-like systems for archiving and distributing files.


Creating a Tarball

1.1 Making a new archive using tar

You can create a gzipped tar archive using the tar command like so:

tar -zvf archive_name.tar.gz files_or_directories_to_archive

Here's what each part of the command does: