tar

Windows CMD · Files · reference only

What it does

Creates and extracts archives (.tar, .tar.gz, .zip). It ships with Windows 10 and 11, based on bsdtar.

Syntax

tar [opciones] [fichero...]

Options and parameters

  • -c

    Creates a new archive.

  • -x

    Extracts the content of an archive.

  • -t

    Lists the content without extracting it.

  • -f archivo

    Name of the archive being worked with.

  • -z

    Compresses or decompresses with gzip.

  • -v

    Shows files as they are processed.

  • -C directorio

    Changes to that directory before extracting or creating.

  • -a

    Chooses the compression format from the extension, including zip.

Usage examples

  • tar -cvf copia.tar carpeta

    Packs a folder into copia.tar without compressing.

  • tar -czf copia.tar.gz carpeta

    Packs and compresses with gzip.

  • tar -xvf copia.tar -C destino

    Extracts the archive into the destino folder.

  • tar -a -cf copia.zip carpeta

    Creates a zip file from a folder.

Notes and common mistakes

  • When extracting, files that already exist are overwritten without asking.
  • The -C destination folder must exist.

Related commands