[tar] Extract a gzip-compressed tar archive

Created on November 30, 2026

Use tar -xzf to extract the members of a .tar.gz archive. The following command extracts archive.tar.gz into the current directory.

tar -xzf archive.tar.gz

A successful extraction normally prints nothing. -x extracts, -z selects gzip, and -f specifies the archive file.

Use -C to choose an existing destination directory.

tar -xzf archive.tar.gz -C extracted

Reference

Shell command tar