tar Command Builder

Create, extract and list tar archives without looking up the flags.

About this tool

Choose whether to create, extract or list an archive, pick the compression (gzip, bzip2, xz or zstd), add files and exclusions, and copy the tar command with every flag explained.

How to use it

  1. Choose Create, Extract or List contents.
  2. Pick the compression; the archive name gets the matching extension.
  3. For a new archive, list the files and folders to include and any patterns to exclude.
  4. Copy the command and read what each flag does.

Questions

How do I extract a .tar.gz file?
Run tar -xzvf file.tar.gz. Add -C folder to extract somewhere else. Modern GNU tar and the tar on macOS detect the compression themselves, so tar -xvf file.tar.gz works too.
Which compression should I choose?
gzip is the safe default that opens everywhere. zstd is usually both faster and smaller, if every machine that opens the file has a recent tar. xz gives the smallest files but is the slowest.
Why does -f have to be last in -czvf?
f takes the next word as the archive name. In -czfv, tar would treat v as the file name. Keep f at the end of the group of letters.
What does --strip-components do?
It removes leading folders from every path while extracting. Archives often contain a top folder like project-1.2/; --strip-components=1 puts its contents straight into the destination.
How do I see what is inside without extracting?
Use List contents, which gives tar -tvf archive.tar.gz. It prints every file with its size and date and changes nothing.

Something not working, or a result looks wrong? Report a problem with this tool