tar Command Builder
Build tar commands to create, extract or list archives with gzip, zstd, xz or bzip2, excludes, a target directory and stripped path components.
Free · No sign-up · Your inputs stay in your browser
Input
Build a tar command
Output
tar command
Command
tar -czvf backup-2026-10-13.tar.gz --exclude=node_modules --exclude=vendor --exclude='*.log' -C /var/www app/ .env
GNU tar and the bsdtar on macOS both detect compression when extracting, so -xf alone works for any of these; it is only needed when creating. --exclude must come before the paths in GNU tar. Extracting an archive you did not make? List it first: a path with ../ can write outside the target directory.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Remembering the letters
c creates, x extracts, t lists, f names the archive and v prints each file. z is gzip, J is xz and j is bzip2; zstd has only the long option --zstd in GNU tar 1.31 and later. When extracting, GNU tar and bsdtar detect the compression themselves, so tar -xf archive works for all of them. See the GNU tar manual.
Relative paths
Creating with -C /var/www app/ stores app/... rather than /var/www/app/..., so the archive extracts wherever you choose. Before extracting an archive from elsewhere, list it with tar -tf: entries starting with / or containing ../ can write outside the target directory.