Comment by shmerl
8 years ago
tar makes a lot more sense if you use long options instead of completely cryptic short ones.
tar command I've been using recently (scripted of course):
To compress:
tar --create --verbose --use-compress-program="pixz" --file foo.tar.xz --directory <bar_dir> .
To extract:
tar --extract --verbose --use-compress-program "pixz -d" --file foo.tar.xz
Unlike bz2 or xz, pixz it uses all CPU cores both for compression and decompression, and as well allows extracting individual files fast. It's also compatible with xz itself.
By the way, at least for the ones I've tried, --extract now figures out the compression algorithm, so --use-compress-program is possibly redundant.
With the cryptic short options it's only one letter, but I find it makes it easier to remember a distinct "4-letter scrabble" for creation versus a "3 letter scrabble" for extraction.
(For the long options you save a lot of typing!)
tar wouldn't be able to figure out to use pixz instead of xz in this case just using implicit deduction.
I don't really type those options, but use some simple wrapper scripts :)
Something like pixzcompress / pixzextract. Scripts also take care to differentiate between directory and a single file.
If you're OK with wrapper scripts, take a look at dtrx[0]. It can extract many different formats, so assuming you have the tools already installed, extracting anything can be done with `dtrx <filename>`.
[0]: https://brettcsmith.org/2007/dtrx/
2 replies →
Good to know, thanks! :)