Was trying to extract a totally legit copy of Skate 3 I downloaded today to play on my Steam Deck
tar --version
You’re welcome
I’d have gone with
tar --help
It’s insane that this isn’t consistent.
Any combination of
-h
,-?
and--help
exists between tools (from 0 to all 3 of them)Never seen
-?
, it’s either-h
,--help
, or-help
for programs that just want to be different.One example for it is … tar!
I suppose I usually try
-h
and if that doesn’t work I try the long version or the man page.
So would have been 1:4
Sorry, the bomb was running MacOS. Your command was not valid and you’ve doomed us all.
It’s literally there at the bottom.
What isn’t valid is MacOS, it’s macOS now.
tar --help
That was my first thought too lol
Rofl me too twins
tar -xzf stands for tar eXtract Ze Filez
You can skip the z; tar is smart enough to figure it out on its own
I like
tar xaf
(eXtract All Files) better.
tar --help
In the true spirit of UNIX, it’s
tar -h
F
It’s
tar --help
on my system 💥GNU switched to long command switches a while ago. Try bsdtar, it’s still just -h.
They kept the short ones for the actual extract/compress commands though, for compatibility reasons I presume.
tar -?
,-h
is dereference or smth.
You just killed us all by putting a space between the dashes
Fuckin autocorrect was the death of us all.
Lmao
Or by using gnu style options on potentially bsd tar
tar --version
Read my mind. :D
I do
tax -xvf filename
tax
Boom.
ah fuck, didn’t even notice
quod erat demonstrandum :D
or quod errat demonstrator, both fit.
quod erat expectandum?
Quot expocto patronum!
Christ this comment chain is perfect lmfao
I like the way you pointed that out lmao
… aaaaaand you’ve killed us all.
tar -h
Just
tar
, no arguments. Does nothing, still a valid command, no?Exit code 2 -> boom
Boom.
tar --help
for anyone wonderingtar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options Try 'tar --help' or 'tar --usage' for more information.
tar -cvzf /etc/
Edit: we’re dead :(
I’d like to know if there are any XKCDs that are no longer relevant.
I’d like to know if there’s an XKCD about an XKCD that’s no longer relevant.
There are some that were wrong to begin with, I remember 622 bothering me.
https://xkcd.com/622/But it could also just be that in the comic, the professor is wrong.
This one, if by unix he also means modern linux systems. Nowadays you can simply use
tar xf my-file.tar.whatever
and it should work on most linux systems (it worked on every modern linux system I’ve tried and every compressed tar file I’ve tried). I don’t think it is hard to remember thexf
part.
tar -xvf or we all kill
shouldnt there be a filename argument ?
Yes. However, if you had skipped the -f, it would have been valid. Without the filename argument, it assumes it should extract from the tape drive (TAR = Tape ARchive). The tape device is probably something like /dev/rmt0, but you don’t need to specify that. Using the -f is technically an exception which means “instead of extracting from the tape like you’d normally do, pretend that this file is the tape device instead.”
GNU tar, at least a modern one, that is the one that happens to come with my system, won’t try to read from
/dev
but stdin and then complain that it’s a terminal and refuse.Quoth POSIX on the
f
flag:Use the first file operand […] as the name of the archive instead of the system-dependent default.
That is GNU is compliant, here, the default is system-dependent.
f -
is required to be stdin, though, so you canbunzip2 foo.tar.bz2 | tar xf -
or such in a portable manner, don’t have to rely on tar having az
option (which is nonstandard) or it auto-detecting compression (even more nonstandard). What is not standard either istar -x
: Tar doesn’t take leading hyphens. Tar is one of those programs so old its command line syntax got standardised before command line syntax standards were established. OTOH it’s not nearly as bad asdd
, you can interpret how tar does things in the same way asgit pull
: It’s a subcommand, not a flag.“one of those programs so old its…syntax got standardized before command line syntax standards were established.” –This is wild to learn, but also confusing. How does tar not take leading hyphens, but I’ve only ever used it as such without error of any kind? Not even bragging I’ve been doing that for 10+ years too lol
Hmm. Actually you prompted me to dig a bit deeper: tar goes all the back to Version 7 UNIX, 1979, but the command line syntax is shared with tap, included in Version 1, man page dated to 1971-11-03. Development of C started 1972. Might’ve been written in B, you’d have to unearth a source archive I bet it’s around somewhere. But anyway if you look through the other Version 1 commands a lot of them don’t take hyphen commands,
ls
does, e.g.rm
doesn’t on account of only taking file names as arguments.dd
is actually younger, Version 5, 1974, the syntax apparantly comes from IBM’s JCL.Admittedly, that’s all before my time.
Both BSD and GNU tar take hyphens, I don’t really have any experience with anything else but a short stint with Solaris in the early 2000s (very emphatically before Sun got gobbled up by Oracle) and I don’t remember hyphens tripping me up. Much unlike
killall
. And I’m apparently not alone in that.
I definitely still killed us all, but at the same time how are you supposed to know any of the filenames if none are given from the comic? I guess my real answer is to ‘tar -xvf’ then hit tab with hopes of decent file completion functionality lol
tar -czf $(ls | head -n1)
if we dont trust globsor run
find
in/bin
or something
ya blew it kid
Actually this reminds me, what is the deal with tar command recommendations to use or not use dash? I know GNU tar accepts both (e.g.)
tar xvf file.tar
andtar -xvf file.tar
, but at some points people were like “NO! Don’t use the dash! It’s going to maybe cause issues somewhere, who knows!” and I was like “OK”. Something to do with people up designing the Unix specs?I didn’t even know the dash was optional. I guess you learn something new everyday.
I still use it though. Its how I learned it all those years ago and its ingrained as muscle memory when typing the command.
idk if it’s optional why bother typing it
personally, it is a little easier to read, especially in a script. and its more consistent with other commands
POSIX. POSIX didn’t get designed but documented behaviour that was portable between different UNIX flavours and was then declared a standard.
If you’re annoyed by it just consider the
xvf
intar xvf
to be a subcommand aspull
is ingit pull
. Tar simply has a fancy subcommand syntax. At least it’s notdd
.No idea, but with tar I never use dashes. Just tar xf away.
tar -xzvf file.tar
That’s what I had in mind too. Tar’s arguments are really intuitive.
x - eXtract
z - use gZip
v - Verbose
f - File (requires the path as an argument)
tar -czvf tar_name.tar.gz ./
I even read this aloud in my head as “CREATE ZE VUCKING FILE” in a particularly bad German accent same as over 20 years ago when a friend I worked for drilled it in my head.
Read it in tf2 medics voice
I didn’t realize that was my default German voice in my head. Thx
lol that’s honestly a great mnemonic
Yep, have this one committed to memory. Though if it asked me to uncompress a tarball, then I’d be fucked
tar xzvf this_awesome_file.tgz
… fixed. Apparently I can’t type.
QED 🫠
File not found, now we are dead.
Sounds like an error message from a
valid tar command
I know tar zxf and xjf off by heart. I probably do 100x as many extracts as creates. Tar is a stupidly antiquated command though.
Why remember/include the algorithm? Tar can infer that. It’s just
bsdtar xf filename.*
for everything. (bsdtar handles .zip as well)The bomb said tar.
Yes, and tar works the same, it just doesn’t handle zip files.
And even if we’re pedantic: bsdtar is Arch Linux’ executable name for a port of the
tar
command that is shipped by BSDs, so it’s alsotar
.
tar