tar --help

tar Command Builder

Stop guessing tar flags. Pick your operation and options to get a correct, copy-ready command.

tar -czvf archive.tar.gz .

Quick Reference

Operations
-cCreate
-xExtract
-tList
-rAppend
Compression
-zgzip
-jbzip2
-Jxz
--zstdzstd
Common flags
-fArchive file
-vVerbose
-pPreserve perms
-CChange directory

Linux tar Syntax Reference

Use this tar command builder to generate correct archive commands for Linux backups, deployments, and data transfer without memorizing every flag combination.

tar FAQ

What does the tar command do in Linux?

tar creates, extracts, and inspects archive files. It is commonly used for backups, software distribution, and moving groups of files between systems.

What is the difference between .tar.gz and .tar.xz?

.tar.gz uses gzip compression, which is fast and widely supported. .tar.xz uses xz compression, which produces smaller archives at the cost of more CPU time.

How do I extract a specific file from a tar archive?

Run tar -xf archive.tar.gz path/to/file to extract only that file. You can also use --wildcards to match patterns.

How do I exclude a directory when creating a tar archive?

Use --exclude=dirname or --exclude='*.log' to skip files matching a pattern. The exclude flag must come before the target path.