xz
Archives
Usage
xz [-T0] [-k] <file>Gives the smallest output of the three common formats but is slow and wants roughly 700 MB of memory at `-9`; it runs single-threaded unless you add `-T0`, it removes the original without `-k`, and the tar flag for it is a capital `-J`.
Common flags
| Flag | Meaning |
|---|---|
| -k | Keep the original. |
| -d | Decompress; unxz is the same. |
| -T0 | Use every core. Single-threaded is the default. |
| -9 | Smallest output. Compression needs roughly 700 MB of RAM at this level. |
| -c | Write to stdout. |
| -l | List what is inside a .xz file. |
Examples
xz -T0 -9 huge.tarSmallest possible archive, using all cores.
xz -dk archive.tar.xzUnpack while keeping the compressed copy.
tar -cJf src.tar.xz ./srcThe tar flag for xz is a capital -J.
Bundling and compressing are separate jobs: tar bundles, gzip shrinks, and .tar.gz is both.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does xz do?
Gives the smallest output of the three common formats but is slow and wants roughly 700 MB of memory at `-9`; it runs single-threaded unless you add `-T0`, it removes the original without `-k`, and the tar flag for it is a capital `-J`.
Q. How do I type it?
xz [-T0] [-k] <file> — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
6 are listed here; the full set is in man xz. This command sits under Archives.
Related commands
man page: man xz