3 ms·
> tar -z (tar is a tape archiver, not a compressor!) Did you not want -z to exist at all (so you would pipe through gzip separately), or not want it to be a ma
by schoen 10y ago
> tar -z (tar is a tape archiver, not a compressor!)
Did you not want -z to exist at all (so you would pipe through gzip separately), or not want it to be a magical default?
GNU changed the -z handling at some point in the last decade (so that it autodetects whether input is compressed upon extraction and decompresses it without being told to), so now tar -xzf foo.tar.gz and tar -xf foo.tar.gz both work, where previously the second one would have failed because tar wouldn't have tried to decompress. Is that change what you're bothered by (it's pretty counterintuitive to me!), or did you just not want compression built into tar at all?
GNU tar now includes flag-based support for -j (bzip2), -J (xz), --lzip, --lzma, --lzop, -z (gzip), and -Z (compress).
- Annatar 10y agoI do not want -z at all, ever; -z has no business in a tape archiver, as it goes against the core UNIX philosophy of "do one thing, and do it well" [McIlroy]. Implementing UNIX tools inside of other UNIX tools is not how UNIX works; that might be acceptable on Windows, but it sucks on UNIX. For example, xz -dvc archive.tar.xz | tar xf - works everywhere as is, including Linux, while tar xzf archive.tar.xz will not work on systems which do not use GNU tar or where GNU tar is not linked with libz, libarchive and liblzma. GNU way is broken, because it is the Windows way, and Windows is busted.
- schoen 10y agoAnother example might be "sort -u" (because you can get the same result from "sort | uniq"). There seems to have been a pattern where people decided that if "foo | bar" (or "bar | foo") is a common enough idiom, they could or should create "foo -b" to mimic it.
- justinsaccount 10y agoExcept that `sort -u` enables an optimization for dealing with a large number of duplicate lines.