Create a compressed tar archive from a folder
Build a paste-ready command, then review its compatibility and effects before running it.
tar -czf <archive-file> <folder>Complete required fields to copy the generated command.
Compatibility
Linux + macOSVerified for Linux, macOS using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-19
Requirementstartar must be installed and available on PATH.
Version supporttar Current supported releasesVerified for linux, macos using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signals(no output on success)Representative successful output; values vary with the selected target and system state.
Known errorstar: command not foundtar is missing or is not available on PATH.
Verifytar -czf {{archiveFile}} {{folder}}Re-run the corresponding read-only inspection and confirm the intended state.Rollback noteNo universal automatic rollback is available. Capture the current state and use the tool-specific recovery procedure before applying changes.
Command breakdown
01tarArchive utilityCreates or extracts tar archives.
02cCreateStarts a new archive.
03zGzip compressionCompresses the archive using gzip.
04fArchive filenameTreats the next argument as the output archive path.
05archive.tar.gzOutput fileNames the compressed archive to create.
06folder/Input folderSelects the directory to place in the archive.
The c, z, and f flags are combined in the single option -czf.
Example input
tar -czf reports-2026-07.tar.gz reports/
Example output
(no output on success)
Created: reports-2026-07.tar.gz
Illustrative output — exact values vary by system and data.
Official sources