utility-option
GNU tar normalized archive
GNU-specific options normalize selected archive metadata. Fix source contents, modes, versions and other inputs; compare outputs. Not a universal reproducibility guarantee.
Formal Syntax & Structure
bash syntaxbash
tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner -cf ARCHIVE FILEReturn Value
exit status
GNU-specific options normalize selected archive metadata. Fix source contents, modes, versions and other inputs; compare outputs. Not a universal reproducibility guarantee.
Working Example
Example Snippetbash
mkdir srcprintf 'app v1\n' > src/app.txtchmod 644 src/app.txtfor name in first second; do tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner -cf "$name.tar" -C src app.txt || exit 1 gzip -n -c "$name.tar" > "$name.tar.gz" || exit 1donecmp -s first.tar.gz second.tar.gz || exit 1printf 'same bytes\n'