Beginner Package: tar

tar

Create and extract archive files.

Syntax

tar [options] archive-file [files...]

Description

tar bundles multiple files and directories into a single archive, traditionally paired with gzip or bzip2 compression, and remains the standard format for distributing and backing up Linux file trees.

Examples

tar -czvf backup.tar.gz /etc
Create a gzip-compressed archive of /etc
tar -xzvf backup.tar.gz
Extract a gzip-compressed archive
tar -tvf backup.tar.gz
List the contents of an archive without extracting it

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux