What is a Tarball (tar.gz file, untar) and example on how to use the tar utility?

Undraw File Manager Re Ms29

About

A tarball (tar.gz file) is a compressed tar archive.

Extract

  • If in zip format
tar -zxvf my.tar.gz
  • Otherwise
tar -xvf my.tar.gz

Extract one descendant file in the current directory

When a file is delivered in a tar file, it's generally in a subdirectory that indicate the version of the application.

Example for postgres_exporter.tar.gz if you unzip/untar it, you will get

postgres_exporter-0.15.0.linux-amd64/
postgres_exporter-0.15.0.linux-amd64/LICENSE
postgres_exporter-0.15.0.linux-amd64/postgres_exporter
postgres_exporter-0.15.0.linux-amd64/NOTICE

To extract the file postgres_exporter-0.15.0.linux-amd64/postgres_exporter in the current directory, you would execute:

tar -xzvf postgres_exporter.tar.gz \
  --strip-components=1 \ # delete the first path part
  --no-anchored \ # search the file name without taking the directory into account
  postgres_exporter 





Discover More
Card Puncher Data Processing
Code Shipping - Archive (Distribution)

In the context of code shipping, an archive: contains module (package) in the following form: compiled code or source or/and other resource files is versioned that are used to distribute...
Card Puncher Data Processing
Docker - Layer

A layer is just the equivalent of a tarball A layer is created at built time via each Dockerfile command. ie each command in the Dockerfile becomes a new layer in the image. Once a layer changes, all...
Card Puncher Data Processing
What is an OCI Image ? (Open Container Initiative)

OCI is a standardized image format from the Open Container Initiative It's used by Docker Image. An OCI image is just a stack of tarballs with a configuration files. The tarballs expand to a directory...
Undraw File Manager Re Ms29
What is an archive ? (Zip, Tar, Jar, ...)

An archive is a tree of file and directory that are grouped in one file.



Share this page:
Follow us:
Task Runner