compress archives with tar and zip
compression level
October 29, 2021
zip
For detailed information, take a look at
# Option '-Z/--compression-method'
man zip
With zip
it is possible to compress archives - Here with compression level 9
:
# -r: Travel the directory structure recursively.
# -v: Verbose mode or print diagnostic version info.
zip -v -r -9 archive.zip /home/user/project
# -Z: Set the default compression method.
zip -Z bzip2 foo bar.c
tar
For detailed information, take a look at
# Section 'Compression options'
man tar
With tar
it is possible to compress archives - Default compression level:
# -c: Create a new archive.
# -v: Verbosely list files processed.
# -f: Use archive file.
# -z: Filter the archive through gzip.
tar czvf archive.tar.gz /home/user/project
# -j: Filter the archive through bzip2.
tar cjvf archive.tar.bz2 /home/user/project
With tar
it is possible to compress archives - Here with compression level 9
:
# 'tar' Writes the archiveto 'stdin'.
# 'gzip' reads from 'stdout'.
tar cvf - /home/user/project | gzip -9 - > archive.tar.gz