Email or username:

Password:

Forgot your password?
April King

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
April King

@qdot it’s one of the worst things a coworker has ever said to me

Sean Gillies

@april I'm going to keep using -z anyway. -xzf means, to me, with a bad French accent "extract zee file".

Watt Mheeler

@april are you actually for real? This has destroyed my entire understanding of the world

Paul_IPv6

@april @afoozle

you young'uns. no respect for tradition. ;)

well. that or muscle memory...

Rachel Rawlings

@april @afoozle which means -J is still needed, which means I'll keep using all the type flags. Doing so hasn't given me carpal tunnel yet.

leah & asm & forth, oh my!

@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

Rachel Rawlings

@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.

Deadly Headshot

@april @afoozle Still necessary for creation, so I'll keep specifying it, thanks...

Tara 🕷️ :butterfly_trans:🌹

@dheadshot not if you use -a and an appropriate extension for the destination
@april @afoozle

Watt Mheeler

@april this is worse than me trying to unlearn apt-get for just apt , I’ll always love apt-cache search

OpenDNA⚙️

@april @afoozle *blink* *blink* the switch doesn't need a hyphen either??

DELETED

@opendna @april @afoozle It’s called the ‘bundled’ option word.

“The first synopsis form shows a “bundled” option word. This usage is provided for compatibility with historical implementations. See COMPATIBILITY below for details.

The other synopsis forms show the preferred usage. The first option to tar is a mode
indicator from the following list:…”

“The bundled-arguments format is supported for compatibility with historic implementations.
It consists of an initial word (with no leading - character) in which each character indicates an option. Arguments follow as separate words. The order of the arguments must match the order of the corresponding characters in the bundled command word. For example,
tar tbf 32 file.tar
specifies three flags t, b, and f. The b and f flags both require arguments, so there must be two additional items on the command line. The 32 is the argument to the b flag, and file.tar is the argument to the f flag.

The mode options c, r, t, u, and x and the options b, f, l, m, o, v, and w comply with
SUSv2.

For maximum portability, scripts that invoke tar should use the bundled-argument format above, should limit themselves to the c, t, and x modes, and the b, f, m, v, and w options.”

manpages.ubuntu.com/manpages/b

@opendna @april @afoozle It’s called the ‘bundled’ option word.

“The first synopsis form shows a “bundled” option word. This usage is provided for compatibility with historical implementations. See COMPATIBILITY below for details.

The other synopsis forms show the preferred usage. The first option to tar is a mode
indicator from the following list:…”

SysAdmin1138

@april This works for the other compressed types too. That's an annoying bash-script I can now make simpler.

Mathieu Comandon

@april omg, it also works for 'J' (and probably 'j') too!

taedryn 🏳️‍⚧️

@riking @april I came here to say this exact thing. Keep the z, it is full of useful meaning. 😁

Thomas Hurst

@riking @april No, for that you just need the 'a' flag.

$ tar caf foo.tar.gz bar
$ tar caf foo.tar.xz bar
$ file foo.tar.*
foo.tar.gz: gzip compressed data
foo.tar.xz: XZ compressed data

Also if you're using bsdtar:

$ tar caf foo.zip bar
$ tar caf foo.7z bar
$ file foo.*
foo.7z: 7-zip archive data
foo.zip: Zip archive data

🌕💀🔮🐦‍⬛

@april Been working with a lot of .tar.xz files and struggling with my muscle memory to leave it off :( :( :(

Blake Coverett

@april Hate to break it to you, but the `-` hasn't been needed for much longer than that. The 80s anyway.

April King

@blakecoverett I knew that but I use the dash out of spite due to its blatant un-UNIX-iness. :)

steelman

@april Whether you use - or not you need -z (and other flags) when reading from stdin. @blakecoverett

Bruce G_NS

@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

TangoAndToys :noverify:

@april Thats so much muscle memory. I have to look up EVERYTIME how to use bzip... :(

Orc

@april Sssh, don't say that too loudly or the FSF will loudly depreciate it.

your idiot friend

@april this is the rudest thing that has graced my timeline in a long time

Eamon

@april ok, wow, but I'm going to retcon my continued use of `-z` (and `-j`) as being about keeping the commands consistent between extract and create mode.

joncamfield

@april it may not be strictly required, but it’s still needed. By me. I need it there.

Robin Tarsiger

@joncamfield @april The emotional support gzip.

Will it help or hurt if I point out that “gzip” has the same cadence as “MMMBop”?

jbaggs

@april Yeah. I think I learned this around 2015 or so, and still manage to type z, J, etc on extraction 80% of the time.

𝒪𝓃𝒶𝓊ℊ 𝒲𝒶𝓃𝓊

@april and use -a on compression and not worry about the right option for compression program

amd

@plumbear @april Alright… this one got me.. gah! I’ll never have to remember J vs j again.

cyberia

@april huh I thought this was particular to GNU tar but I just checked and the BSDs have it too

kepstin

@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 you can untar an iso file? What? Am I dreaming now?

DELETED

@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.

To examine the contents of an ISO 9660 cdrom image:
tar -tf image.iso

opensource.apple.com/source/li

Jason Levine

@april What. The. Fuck. Good luck convincing my fingers and brainstem of that.

April King

@lmorchard hope you’ll be there at our retirement home’s bingo tournament tonight

Goth'n'Bass

@lmorchard

@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.

jade

@JoYo @april @float13 yes, since it can't really be inferred

Gabriel Pettier

@leftpaddotpy @JoYo @april @float13 you would assume so, but no, it's not needed either, if you use the `a` flag, see the man. :)

mas.to/@tshirtman/110307586640

jade

@april in your defense, they took another 8-10 years or something to add it to the bsd versions. but it's now been in those too for years.

DuncanWatson

@april@macaw.social I have used a lot of non-gnu tar so I don't care April's colleague.

Michael Wyman

@april great, I just aged 20 years after reading this post

Bartek Ogryczak

@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).

Gabriel Pettier

@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,}
$ tar acf directory{.tar.bz2,}
$ tar acf directory{.tar.xz,}

$ file directory.*
directory.tar.bz2: bzip2 compressed data, block size = 900k
directory.tar.gz: gzip compressed data, from Unix, original size modulo 2^32 28272640
directory.tar.xz: XZ compressed data, checksum CRC64

Bartek Ogryczak

@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.

Lightfighter

@april then who/what is going to play the xylophone?

Dhavide Aruliah

@april

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!

Daniel Lowe

@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.

luciano

@april no one will ever stop me from xtracting ze file verbosely

Gabriel Pettier

@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.

Tim Reed

@april Surely 'z' is still needed when creating compressed tar files?

kepstin

@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)

Tim Reed

@kepstin my decades of unix experience no longer has value :(

Matt Daemon

@april They will pry that z from my cold dead hands.

AlgoCompSynth by znmeb

@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.

NoHomers

@april Really? Haven't tar'd anything in a while but that sounds like crazy talk. Next you're gonna say `gzip -9` the 9 isn't necessary.

Eli the Bearded

@april Sheet, man. Never needed that initial hyphen either

Jeffrey Ross-Ibarra

@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.

Chris Petrilli

@april also i still use the even older version without the dash. because… :waves a cane:

pyrrhlin

@april what?! I still type it, too. But why would I bother to read the man page in the last 20 years?

Pseudo Nym

@april@macaw.social <falls to dust like the CryptKeeper exposed to sunlight>

Muscle memory permanently encoded

Jason Davis

@april I still catch myself typing the z once in a while

Zach Fine

@april What if I need the z so that the call to compress and the call to extract look similar and I don't have to remember a different set of flags? e.g. 'tar cvzpf'

Robbie Coleman

@april that's just 4 years after I learned the command. LOL

Joe

@april I think the z will save you a few microseconds (it expects gzip compression right away instead of trying to read an uncompressed stream and trying again with decompression turned on). So you can tell your colleague that you're just being efficient.

DELETED

@april No way, that "z" stays in.

Not just because I'm old (Yep!), but I don't want to learn two ways of doing this whenever I potentially do something on an old Linux system that has been stuck in amber for the last 18 years.

aburka 🫣

@april At the risk of being remotely flipped off, the `-` isn't necessary either. This is [called](gnu.org/software/tar/manual/ht) the "old option style" so I guess there's no version to point to.

April King

@aburka I’m aware, but I refuse to not use dashes as it doesn’t feel right. :)

[0]

@april I refuse to let tar think less of me by omitting that information, we’ve built up too much rapport over the years to hold back like that

klausfiend

@april well, shit ... now I guess I have break my fingers to forcibly purge the useless muscle memory needed for that one extra keystroke

Kerfuffle

@april
Next thing you're telling me is that I don't have to use v1440 with ARJ compression anymore and I bought all these floppies for nothing.

Filipi Limi

@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

Heath Borders

@april I love it. You don't need the v either, but that's more obvious. 😜

Alex Rudnick

@april It's there for *documentation*. You put it there because you know you're dealing with a gzip'd tarball.

DELETED

@april @pmbauer but if you write tar -xzvf instead it makes it more readable because you know it means “extract ze vucking files”

Seth Galitzer

@april It will take me 20 more years to remove it from muscle memory.

Matt

@april I think it still has purpose. It's a quick way to assert that you are extracting/listing files from a gzipped tar. When that fails, you know you may have another issue (why wasn't this in gzip format??)

aardvark

@april I may have found a whole lotta people to follow

aardvark

@april tar will never get the user uptake it needs until it addresses the options issue!

Tara 🕷️ :butterfly_trans:🌹

@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

mx alex tax1a - 2020 (4)

@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 - shar :)

arclight

@april Yeah, I still use -z out of habit. Weirdly, I recently learned tar supports xz decompression - that was a pleasant discovery.

bassplayer

@april This reminds me of the env var for the ps command I_WANT_A_BROKEN_PS

Lisa

@april While you're at it, drop the v and watch it work faster.

Fennix :donor:

@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).

Fennix :donor:

@mikeylikestech @april I still remember when bz2 was all the rage and tar finally added the -j flag.

Cocoa

@april okay but then how am I supposed to remember to eXtract Zie Vucking Files

Frank :emacs: :arch: :sway:

@april Way to ruin the morning. How about a content warning next time.😉

Momo

@april
Omg I hate this! I hate this soo much!!! I want this knowledge out of my head RIGHT NOW!! 😭
@vaurora

Alan Brookland

@april It hasn't? Oh well, I'm too set in my ways to change now!

Go Up