About this tool
Build correct tar create, extract and list commands with compression, exclude patterns, strip-components and safe quoting.
This builder assembles a ready-to-run GNU tar command for creating, extracting or listing an archive, with the compression filter, exclude patterns and quoting worked out for you. It follows the flag semantics documented in GNU tar 1.35, including the rule that --exclude must appear before the member names and that -C changes directory for everything after it. Useful for anyone who writes backup scripts occasionally and re-reads the man page every time.
Open Tar Command Builder on AltFTool — it loads instantly in your browser.
Paste your code or data sample into the workspace.
Pick the format, conversion, or analysis you need.
Copy the polished result straight back into your project.
Position-sensitive options like --exclude and -C are placed where GNU tar actually honours them.
Paths with spaces or brackets are wrapped in POSIX single quotes so the shell cannot re-split them.
Each option in the generated line comes with a one-line description, so you learn the command rather than just paste it.
-z pipes the archive through gzip and -J through xz. gzip is faster and available everywhere; xz usually produces a file 20-40% smaller but takes far longer and needs much more memory to compress.
Use tar -xzf archive.tar.gz -C /target/dir. The target directory must already exist — tar will not create it — and without -C the archive unpacks into your current working directory.
It removes the first path component from every member as it is extracted, which is how you unpack a release tarball that wraps everything in a project-1.2.3/ folder directly into the current directory.
GNU tar strips the leading slash from absolute paths so an archive can never overwrite system files on extraction. To avoid the warning, cd into the parent with -C and add relative paths instead.