Why Archives Matter
Archives bundle multiple files into a single package for transfer, backup, or distribution. Understanding the common archive formats on Linux helps you efficiently manage files on your Breeze.
tar (Tape Archive)
The most common Linux archive tool. By itself, tar bundles files without compression:
# Create a tar archive
tar cf backup.tar /var/www/html
# Extract a tar archive
tar xf backup.tar
# List contents without extracting
tar tf backup.targzip (.tar.gz or .tgz)
Fast compression with good ratios. The most popular Linux combination:
# Create compressed archive
tar czf backup.tar.gz /var/www/html
# Extract
tar xzf backup.tar.gz
# Compress a single file
gzip largefile.log
# Produces largefile.log.gz, removes original
# Decompress
gunzip largefile.log.gzbzip2 (.tar.bz2)
Better compression ratio than gzip but slower:
# Create bzip2 archive
tar cjf backup.tar.bz2 /var/www/html
# Extract
tar xjf backup.tar.bz2xz (.tar.xz)
Best compression ratio, slowest speed. Ideal for distribution:
# Create xz archive
tar cJf backup.tar.xz /var/www/html
# Extract
tar xJf backup.tar.xzzip
Cross-platform format, widely compatible:
# Create zip archive
zip -r backup.zip /var/www/html
# Extract
unzip backup.zip
# List contents
unzip -l backup.zip
# Extract to specific directory
unzip backup.zip -d /tmp/restoredQuick Reference
- Fastest: gzip -- use for routine backups
- Best ratio: xz -- use for archival or distribution
- Cross-platform: zip -- use when sharing with non-Linux users
- Balanced: bzip2 -- between gzip and xz in speed and ratio