big middle finger to the universe, but especially to the colleague who made my bones hurt by pointing out that the `z` in `tar -xvzf` hasn’t been needed since version tar 1.15, released in 2004.
big middle finger to the universe, but especially to the colleague who made my bones hurt by pointing out that the `z` in `tar -xvzf` hasn’t been needed since version tar 1.15, released in 2004. 212 comments
12
@april I'm going to keep using -z anyway. -xzf means, to me, with a bad French accent "extract zee file". @april are you actually for real? This has destroyed my entire understanding of the world @LinuxAndYarn @april @afoozle it's not - .tar.xz archives are also automatically recognised. tested on GNU tar v1.34 and busybox tar v1.34.1 @millihertz @april @afoozle Sonofagun, it's true. Next time I'll go to the desktop and open a terminal instead of just lying back with my tablet. @dheadshot not if you use -a and an appropriate extension for the destination @april this is worse than me trying to unlearn apt-get for just apt , I’ll always love apt-cache search @april This works for the other compressed types too. That's an annoying bash-script I can now make simpler. @riking @april No, for that you just need the 'a' flag. $ tar caf foo.tar.gz bar Also if you're using bsdtar: $ tar caf foo.zip bar @april Hate to break it to you, but the `-` hasn't been needed for much longer than that. The 80s anyway. @blakecoverett I knew that but I use the dash out of spite due to its blatant un-UNIX-iness. :) @april Whether you use - or not you need -z (and other flags) when reading from stdin. @blakecoverett @blakecoverett @april Dang it you all are making me feel ruddy ancient. Not that I’m not ancient but I was enjoying that delusion. Next you’ll tell me that I don’t need the -r for recursive zip file building @april Thats so much muscle memory. I have to look up EVERYTIME how to use bzip... :( @thomasfuchs @april @gsuberland oh my god, same, I JUST started omitting it in the last couple years. @joncamfield @april The emotional support gzip. Will it help or hurt if I point out that “gzip” has the same cadence as “MMMBop”? @april and use -a on compression and not worry about the right option for compression program @cyberia @april at least some of the bsds use the tar implementation based on libarchive, which not only lets you omit the 'z', but it also works on random other formats, like zip, cpio, 7z, iso, etc. files. At least that way you don't have to remember multiple sets of alphabet soup options for different tools. @fraggle @kepstin @cyberia @april yup! “This implementation can extract from tar, pax, cpio, zip, jar, ar, and ISO 9660 cdrom images and can create tar, pax, cpio, ar, and shar archives. https://opensource.apple.com/source/libarchive/libarchive-14/libarchive/doc/text/bsdtar.1.auto.html @april I have some spare paper if you need it. Took me ages to find some when I started using a fountain pen again. Then I discovered that inks dry so much faster than when I was in school, that you just don't need to blot it any more. Somehow, it feels entirely in keeping with this thread. @leftpaddotpy @JoYo @april @float13 you would assume so, but no, it's not needed either, if you use the `a` flag, see the man. :) @april@macaw.social I have used a lot of non-gnu tar so I don't care April's colleague. @april does it auto-detect compression type? Does it mean that `-j` and `-J` are also unnecessary when extracting? (also, tar is a Terrible ARchive format, it should die already). @bartek @april yes, it's unnecessary, and even when creating an archive, you can use the `a` flag to autodetect format. $ tar acf directory{.tar.gz,} $ file directory.* @tshirtman @april Nice. Still, given that zip is an open format, and unlike tar has proper structure, with index, checksums, etc, I'd rather see it used more often. It's already being used by so much of open-source as the basis of package format, yet so many still stick to tar. Wait, what? I've been doing this "the old way" for almost 20 years and never noticed? A pox upon your co-worker! Get out of my yard! @april This was in direct response to a popular blog post pointing out how stupid it was that we had to specify it. I think it made Slashdot (Digg?) front page. @april the '-' is not needed anymore, but i'm not going to lookup since when. `tar xf filename` edit: should have read the other comments, you knew that already. @timothyreed @april nowadays you probably want to use 'a' instead, which automatically picks the right compressor to use based on the output filename you used. (Explicitly specifying the compressor is still needed if you're piping the output rather than writing to a file, tho) @april I think it still needs the `z` if you pipe a stream into `tar` rather than giving it a filename. With a file, it can look at the file and see what it contains, but if you send it a stream it has problems. @april common misconception. The z is for “—zoinks” and is needed to express the appropriate level of surprise at how well compressed the files were. Without it tar feels mightily under appreciated. @april also i still use the even older version without the dash. because… :waves a cane: @april@macaw.social <falls to dust like the CryptKeeper exposed to sunlight> @april At the risk of being remotely flipped off, the `-` isn't necessary either. This is [called](https://www.gnu.org/software/tar/manual/html_section/Styles.html#Old-Options) the "old option style" so I guess there's no version to point to. @april well, shit ... now I guess I have break my fingers to forcibly purge the useless muscle memory needed for that one extra keystroke @april oh, they didn't mention bsdtar? untarring EVERY download on the fly directly from stdout? not some, all yes, that one too yup, that one too haven't tried myself, but probably it works for that one too @april It's there for *documentation*. You put it there because you know you're dealing with a gzip'd tarball. @april also the dash isn't needed... though i always use it too 😅 `tar xf` (or `xvf` if you want to be verbose) is all you need! `tar caf foo.tar.gz` is all you need to create one too @tarajdactyl @april libarchive-based tar (the default on OS X and freebsd) can read tarballs, zip files, ISO images, Warcs, some RARs, microsoft CABs, and 7z files, and can write tar, zip, 7z, and (our personal favorite) shell archives - @april it is however needed when creating the archive if you want it compressed, so from an ergonomic standpoint IMO adding it doesn't really hurt and gives better consistency (x for extract, c for create, everything else stays the same). @mikeylikestech @april I still remember when bz2 was all the rage and tar finally added the -j flag. |
@april FUCK