tar

Archive and extract files.

KaliParrotLinuxpassive

pkg: tar

tar bundles files into archives (optionally compressed) — used for packaging loot, backups and transfers.

Syntax

tar {c|x}{z|j}{f} {archive} [files]

Example

tar czf loot.tar.gz /var/www/html

Creates a gzip-compressed archive of the web root for exfil/backup.

Options & flags

What each switch does. Toggle them in the builder below to assemble a command.

-cCreate an archive.
-xExtract an archive.
-zgzip compression (.tar.gz).
-jbzip2 compression (.tar.bz2).
-f <out.tar.gz>Archive filename (must come last of the flags).
-vVerbose (list files).
-C </path>Change to a directory first.

Command builder

Tick options (and fill any values) to build a ready-to-copy command.

tar

Usage examples

tar czf loot.tar.gz /var/www/html

Create a gzip archive of a folder.

tar xzf archive.tar.gz -C /tmp

Extract into /tmp.

Advantages
  • Ubiquitous archiving
  • Compression options (gz/bz2/xz)
  • Preserves permissions/timestamps
Disadvantages
  • Flag order trips people up
  • Large archives are slow
  • No built-in encryption
Tags
#archive#transfer

Official docs: GNU tar

Related commands

Frequently asked questions

What is tar used for?
tar bundles files into archives (optionally compressed) — used for packaging loot, backups and transfers.
What is an example tar command?
A common example is: tar czf loot.tar.gz /var/www/html — Creates a gzip-compressed archive of the web root for exfil/backup.
Is tar part of Kali Linux?
Yes. tar ships with Kali Linux (and Parrot OS). If missing, install it with: sudo apt install tar.
What category of security tool is tar?
tar is a Core Linux tool with a passive-risk profile when run against a live target.

Try recon tools live

Run real scans against a domain you control, stage by stage.

Open the lab →