Various scripts in various languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Matteo Cypriani d321ec9761 [archivers] xzize: output file to same directory 1 year ago
.. [archivers] xzize: improve doc 1 year ago
TODO Rename compression_utils -> archivers 3 years ago [archivers] shellcheck 2 years ago [archivers] xzize: output file to same directory 1 year ago (lz and uz)

The script emulates and extends commands lz and uz from the mtools.

Note: although is more powerful than mtools' lz and uz, you should probably use als and aunpack from the atool package instead; they are much better and atool provides several other useful commands as well. This script is still useful when you can't install Perl (atool is written in Perl).

This script handles the following archive formats through the standards options of GNU Tar:

  • tar
  • tar.gz (tgz)
  • tar.bz2 (tbz, tb2)
  • tar.xz (txz)
  • tar.lzma (tlz)
  • tar.Z (taz)

Note that you need GNU Tar, at least version 1.20 to support LZMA compressed archives, and version 1.22 for XZ compressed ones.

If the script is called as lz, the archive content is displayed. When called as uz, it is extracted.

To install lz and uz, move the script as lz in a directory in your PATH (for instance /usr/local/bin or $HOME/bin) and hard link it to uz:

cp /usr/local/bin/lz
ln /usr/local/bin/{lz,uz}

Alternatively, you can use the symbolic links provided along with the repository by adding the bin directory to your PATH, as explained in the main file.

The script compresses an uncompressed file, or recompresses a compressed file to XZ (with default compression level).

Known compression formats are GZip (.gz), BZip2 (.bz2), LZMA (.lzma), and Lempel-Ziv (.Z). Short tar compressed suffixes are also allowed: .tgz, .tbz, .tb2, .tlz, .taz (and the output file's extension will be .txz).

In case of recompression, the original compressed file is kept (so you can compare input and output file sizes and decide to keep the original or the recompressed file). In case of compression (i.e. when the suffix of the file does not correspond to a known compression format), the original uncompressed file is removed.

Note: the atool package provides the arepack command, which can recompress to several formats and not only to XZ. xzize has the advantage to recompress on the fly rather than unpacking the archive entirely on the file system and repacking it afterwards.