If you like the pipe mode, this is the cleanest solution:
tar c some-dir | xz > some-dir.tar.xz
No need to set the f parameter to process files, and then use - to indicate that the file is standard input. There is also no need to specify the -z option for xz , because it is the default.
It also works with gzip and bzip2 :
tar c some-dir | gzip > some-dir.tar.gz
or
tar c some-dir | bzip2 > some-dir.tar.bz2
Decompression is also quite simple:
xzcat tarball.tar.xz | tar x bzcat tarball.tar.bz2 | tar x zcat tarball.tar.gz | tar x
If you only have a tar archive, you can use cat :
cat archive.tar | tar x
If you only need to list the files, use tar t .
Rafael van Horn Jan 05 '15 at 18:11 2015-01-05 18:11
source share