XZ Utils (previously LZMA Utils) is a set of
free software
Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, no ...
command-line
A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
lossless data compressors, including the programs lzma and xz, for
Unix-like
A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
operating systems and, from version 5.0 onwards,
Microsoft Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
. For compression/decompression the
Lempel–Ziv–Markov chain algorithm
The Lempel–Ziv–Markov chain algorithm (LZMA) is an algorithm used to perform lossless data compression. It has been under development since either 1996 or 1998 by Igor Pavlov and was first used in the 7z format of the 7-Zip archiver. This ...
(LZMA) is used. XZ Utils started as a Unix port of
Igor Pavlov's LZMA-
SDK that has been adapted to fit seamlessly into Unix environments and their usual structure and behavior.
Features
In most cases, xz achieves higher compression rates than alternatives like
gzip
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and in ...
and
bzip2. Decompression speed is higher than bzip2, but lower than gzip. Compression can be much slower than gzip, and is slower than bzip2 for high levels of compression, and is most useful when a compressed file will be used many times.
XZ Utils consists of two major components:
* , the command-line compressor and decompressor (analogous to
gzip
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and in ...
)
* liblzma, a
software library
In computer science, a library is a collection of non-volatile resources used by computer programs, often for software development. These may include configuration data, documentation, help data, message templates, pre-written code and subr ...
with an
API
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
similar to
zlib
zlib ( or "zeta-lib", ) is a software library used for data compression. zlib was written by Jean-loup Gailly and Mark Adler and is an abstraction of the DEFLATE compression algorithm used in their gzip file compression program. zlib is also ...
Various command shortcuts exist, such as (for ), (for ; analogous to ) and (for ; analogous to )
XZ Utils can compress and decompress both the ''xz'' and ''lzma'' file formats, but since the LZMA format is now
legacy
In law, a legacy is something held and transferred to someone as their inheritance, as by will and testament. Personal effects, family property, marriage property or collective property gained by will of real property.
Legacy or legacies may refer ...
,
XZ Utils compresses by default to xz.
Usage
Both the behavior of the software as well as the properties of the file format have been designed to work similarly to those of the popular Unix compressing tools
gzip
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and in ...
and
bzip2.
Just like gzip and bzip, xz and lzma can only compress single files (or data streams) as input. They cannot bundle multiple files into a single
archive
An archive is an accumulation of historical records or materials – in any medium – or the physical facility in which they are located.
Archives contain primary source documents that have accumulated over the course of an individual or ...
– to do this an archiving program is used first, such as
tar
Tar is a dark brown or black viscous liquid of hydrocarbons and free carbon, obtained from a wide variety of organic materials through destructive distillation. Tar can be produced from coal, wood, petroleum, or peat. "a dark brown or black bit ...
.
Compressing an archive:
xz my_archive.tar # results in my_archive.tar.xz
lzma my_archive.tar # results in my_archive.tar.lzma
Decompressing the archive:
unxz my_archive.tar.xz # results in my_archive.tar
unlzma my_archive.tar.lzma # results in my_archive.tar
Version 1.22 or greater of the
GNU
GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
implementation of tar has transparent support for tarballs compressed with lzma and xz, using the
switches
In electrical engineering, a switch is an electrical component that can disconnect or connect the conducting path in an electrical circuit, interrupting the electric current or diverting it from one conductor to another. The most common type of ...
or for xz compression, and for LZMA compression.
Creating an archive and compressing it:
tar -c --xz -f my_archive.tar.xz /some_directory # results in my_archive.tar.xz
tar -c --lzma -f my_archive.tar.lzma /some_directory # results in my_archive.tar.lzma
Decompressing the archive and extracting its contents:
tar -x --xz -f my_archive.tar.xz # results in /some_directory
tar -x --lzma -f my_archive.tar.lzma # results in /some_directory
Single-letter tar example for archive with compress and decompress with extract using
short suffix:
tar cJf keep.txz keep # archive then compress the directory ./keep/ into the file ./keep.txz
tar xJf keep.txz # decompress then extract the file ./keep.txz creating the directory ./keep/
xz has supported multi-threaded compression (with the flag)
since 2014, version 5.2.0.; since version 5.4.0 threaded decompression has been implemented. Threaded decompression requires multiple compressed blocks within a stream which are created by the threaded compression interface.
The number of threads can be less than defined if the file is not big enough for threading with the given settings or if using more threads would exceed the memory usage limit.
The xz format
The xz format improves on lzma by allowing for preprocessing filters. The exact filters used are similar to those used in
7z, as 7z's filters are available in the public domain via the LZMA SDK.
Development and adoption
Development of XZ Utils took place within the Tukaani Project, which was led by Mike Kezner, by a small group of developers who once maintained a
Linux distribution
A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and, often, a package management system. Linux users usually obtain their operating system by downloading one ...
based on
Slackware
Slackware is a Linux distribution created by Patrick Volkerding in 1993. Originally based on Softlanding Linux System, Slackware has been the basis for many other Linux distributions, most notably the first versions of SUSE Linux distributions ...
.
All of the
source code
In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
for xz and liblzma has been released into the
public domain
The public domain (PD) consists of all the creative work
A creative work is a manifestation of creative effort including fine artwork (sculpture, paintings, drawing, sketching, performance art), dance, writing (literature), filmmaking, ...
. The XZ Utils source distribution additionally includes some optional scripts and an example program that are subject to various versions of the
GPL
The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software licenses that guarantee end users the four freedoms to run, study, share, and modify the software. The license was the first copyleft for general u ...
.
Specifically, the full list of
GPL
The GNU General Public License (GNU GPL or simply GPL) is a series of widely used free software licenses that guarantee end users the four freedoms to run, study, share, and modify the software. The license was the first copyleft for general u ...
scripts and sources distributed with the XZ Utils software include:
* An optional implementation of a common libc function,
getopt
Getopt is a C library function used to parse command-line options of the Unix/POSIX style. It is a part of the POSIX specification, and is universal to Unix-like systems.
It is also the name of a Unix program for parsing command line arguments ...
(
GNU GPL v2 and
GNU LGPL v2.1)
* An m4 script for pthread detection (
GNU GPL v3)
* Some nonessential wrapper scripts (xzgrep, etc) (
GNU GPL v2)
* And the example program scanlzma, which is not integrated with the build system
The resulting software xz and liblzma binaries are public domain, unless the optional LGPL
getopt
Getopt is a C library function used to parse command-line options of the Unix/POSIX style. It is a part of the POSIX specification, and is universal to Unix-like systems.
It is also the name of a Unix program for parsing command line arguments ...
implementation is incorporated.
Binaries are available for
FreeBSD
FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
,
NetBSD
NetBSD is a free and open-source Unix operating system based on the Berkeley Software Distribution (BSD). It was the first open-source BSD descendant officially released after 386BSD was forked. It continues to be actively developed and is a ...
,
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which ...
systems,
Microsoft Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
, and
FreeDOS
FreeDOS (formerly Free-DOS and PD-DOS) is a free software operating system for IBM PC compatible computers. It intends to provide a complete MS-DOS-compatible environment for running Legacy system, legacy software and supporting embedded system ...
. A number of
Linux distribution
A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and, often, a package management system. Linux users usually obtain their operating system by downloading one ...
s, including
Fedora
A fedora () is a hat with a soft brim and indented crown.Kilgour, Ruth Edwards (1958). ''A Pageant of Hats Ancient and Modern''. R. M. McBride Company. It is typically creased lengthwise down the crown and "pinched" near the front on both sides ...
,
Slackware
Slackware is a Linux distribution created by Patrick Volkerding in 1993. Originally based on Softlanding Linux System, Slackware has been the basis for many other Linux distributions, most notably the first versions of SUSE Linux distributions ...
,
Ubuntu
Ubuntu ( ) is a Linux distribution based on Debian and composed mostly of free and open-source software. Ubuntu is officially released in three editions: ''Desktop'', ''Server'', and ''Core'' for Internet of things devices and robots. All the ...
, and
Debian
Debian (), also known as Debian GNU/Linux, is a Linux distribution composed of free and open-source software, developed by the community-supported Debian Project, which was established by Ian Murdock on August 16, 1993. The first version of D ...
use xz for compressing their software packages.
Arch Linux
Arch Linux () is an independently developed, x86-64 general-purpose Linux distribution that strives to provide the latest stable versions of most software by following a Rolling release, rolling-release model. The default installation is a minim ...
previously used xz to compress packages, but as of December 27, 2019, packages are compressed with
Zstandard
Zstandard, commonly known by the name of its reference implementation zstd, is a lossless data compression algorithm developed by Yann Collet at Facebook.
''Zstd'' is the reference implementation in C. Version 1 of this implementation was r ...
compression.
The
GNU
GNU () is an extensive collection of free software (383 packages as of January 2022), which can be used as an operating system or can be used in parts with other operating systems. The use of the completed GNU tools led to the family of operat ...
FTP archive also uses xz.
References
External links
Official WebsiteSourceForge project page
{{DEFAULTSORT:Xz Utils
Free data compression software
Free software programmed in C
Public-domain software with source code
Unix archivers and compression-related utilities