Old XKCD, still relevant

Was trying to extract a totally legit copy of Skate 3 I downloaded today to play on my Steam Deck

887 points · 155 comments · view on lemmy.world

155 Comments

oleorun@real.lemmy.fan · 149 pts · 2y (10 replies)

tar --help

dohpaz42@lemmy.world · 149 pts · 2y (5 replies)

In the true spirit of UNIX, it’s tar -h

Gork@lemm.ee · 37 pts · 2y

F

foobaz@lemmy.world · 13 pts · 2y (1 reply)

It's tar --help on my system 💥

0x4E4F@sh.itjust.works · 7 pts · 2y

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.

dogsoahC@lemm.ee · 4 pts · 2y

tar -?, -h is dereference or smth.

barsoap@lemm.ee · 2 pts · 2y

Nope, tar spec doesn't say anything about a help message. The man spec OTOH requires at least syntax documentation for all standard utilities to be present on the system.

jflorez@sh.itjust.works · 68 pts · 2y (3 replies)

You just killed us all by putting a space between the dashes

oleorun@real.lemmy.fan · 62 pts · 2y (1 reply)

Fuckin autocorrect was the death of us all.

Phrodo_00@lemmy.world · 28 pts · 2y

Or by using gnu style options on potentially bsd tar

JackGreenEarth@lemm.ee · 85 pts · 2y (4 replies)
tar -h
woelkchen@lemmy.world · 51 pts · 2y (1 reply)

Just tar, no arguments. Does nothing, still a valid command, no?

foobaz@lemmy.world · 35 pts · 2y

Exit code 2 -> boom

rrconkle@lemmy.zip · 31 pts · 2y
tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options
Try 'tar --help' or 'tar --usage' for more information.
doctorzeromd@sopuli.xyz · 24 pts · 2y

Boom. tar --help for anyone wondering

kameecoding@lemmy.world · 73 pts · 2y (9 replies)

I do tax -xvf filename

WhiskyTangoFoxtrot@lemmy.world · 150 pts · 2y (7 replies)

tax

Boom.

kameecoding@lemmy.world · 49 pts · 2y (5 replies)

ah fuck, didn't even notice

justme@lemmy.dbzer0.com · 18 pts · 2y (3 replies)

quod erat demonstrandum :D

Karyoplasma@discuss.tchncs.de · 6 pts · 2y

or quod errat demonstrator, both fit.

gandalf_der_12te@discuss.tchncs.de · 1 pts · 2y (1 reply)

quod erat expectandum?

justme@lemmy.dbzer0.com · 3 pts · 2y

Quot expocto patronum!

Bosht@lemmy.world · 14 pts · 2y

Christ this comment chain is perfect lmfao

DogWater@lemmy.world · 22 pts · 2y

I like the way you pointed that out lmao

Voroxpete@sh.itjust.works · 44 pts · 2y

.... aaaaaand you've killed us all.

prettybunnys@sh.itjust.works · 52 pts · 2y (12 replies)

tar -czvf tar_name.tar.gz ./

v_krishna@lemmy.ml · 48 pts · 2y (3 replies)

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.

RealPuyo@lemmy.world · 14 pts · 2y (1 reply)

Read it in tf2 medics voice

Edgarallenpwn@midwest.social · 4 pts · 2y

I didn't realize that was my default German voice in my head. Thx

gravitas_deficiency@sh.itjust.works · 1 pts · 2y

lol that’s honestly a great mnemonic

rockSlayer@lemmy.world · 9 pts · 2y (5 replies)

Yep, have this one committed to memory. Though if it asked me to uncompress a tarball, then I'd be fucked

thejml@lemm.ee · 9 pts · 2y (4 replies)

tar xzvf this_awesome_file.tgz

… fixed. Apparently I can’t type.

hallettj@leminal.space · 10 pts · 2y (2 replies)

I think you want to remove the c because that means "create" an archive, and you're missing a z which applies gzip decompression/compression

_thebrain_@sh.itjust.works · 13 pts · 2y (1 reply)

I suppose it is tar version dependent, but on any recent Linux version I have used, you can just tar xvf <tar_name.tar.{z,gz,xz,etc}> and it will automatically figure out if it is compressed, what tools were used to compress it, and how to decompress it.

But you are right, x and c are mutually exclusive.

thejml@lemm.ee · 1 pts · 2y

Yeap, apparently I can’t type. So, we’d all be dead anyway with that bomb.

gravitas_deficiency@sh.itjust.works · 1 pts · 2y

QED 🫠

Aurenkin@sh.itjust.works · 6 pts · 2y (1 reply)

File not found, now we are dead.

prettybunnys@sh.itjust.works · 3 pts · 2y

Sounds like an error message from a valid tar command

doggle@lemmy.dbzer0.com · 51 pts · 2y (8 replies)

tar --version

You're welcome

bitwaba@lemmy.world · 17 pts · 2y (5 replies)

I'd have gone with tar --help

flying_sheep@lemmy.ml · 11 pts · 2y (4 replies)

It's insane that this isn't consistent.

Any combination of -h, -? and --help exists between tools (from 0 to all 3 of them)

zaphod@sopuli.xyz · 5 pts · 2y (2 replies)

Never seen -?, it's either -h, --help, or -help for programs that just want to be different.

flying_sheep@lemmy.ml · 2 pts · 2y (1 reply)
zaphod@sopuli.xyz · 1 pts · 2y

I suppose I usually try -h and if that doesn't work I try the long version or the man page.

FMEEE@lemmy.dbzer0.com · 2 pts · 2y

So would have been 1:4

Aganim@lemmy.world · 6 pts · 2y (1 reply)

Sorry, the bomb was running MacOS. Your command was not valid and you've doomed us all.

Andrew15_5@mander.xyz · 1 pts · 2y

It's literally there at the bottom.

What isn't valid is MacOS, it's macOS now.

Lime66@lemmy.world · 45 pts · 2y (1 reply)
tar --version
Oderus@lemmy.world · 3 pts · 2y

Read my mind. :D

b3an@lemmy.world · 45 pts · 2y (11 replies)

Somehow, idk why. This one is stuck in my head:

tar -zxvf filename.tar.gz
far_university1990@feddit.de · 86 pts · 2y (1 reply)

tar xzvf

eXtract Ze Vucking File

Bread@sh.itjust.works · 16 pts · 2y

I have to do this command often at work and I can never remember the letters perfectly. This is actually useful, thanks!

BestBouclettes@jlai.lu · 17 pts · 2y (3 replies)

The bomb runs AIX. I'm sorry, you're dead

MonkderDritte@feddit.de · 7 pts · 2y (2 replies)

tar zxvf filename.tar.gz file?

BestBouclettes@jlai.lu · 9 pts · 2y (1 reply)

Nope, tar doesn't handle compression on AIX. So it would be something like gzip -cd filename.tar.gz | tar xvf -

MonkderDritte@feddit.de · 8 pts · 2y

Ugh.

9point6@lemmy.world · 2 pts · 2y (4 replies)

Same, never used a mnemonic for it or anything, just

zxvf

Like it's any other word

MonkderDritte@feddit.de · 2 pts · 2y (3 replies)

z=zip (default in most tar), x=eXtract, v=verbose (not needed in most cases), f=target

prettybunnys@sh.itjust.works · 4 pts · 2y (2 replies)

verbose … not needed?

If the words don’t happen how can I trust computer magic?

InFerNo@lemmy.ml · 2 pts · 2y (1 reply)

Yeah, how do I know that the PC isn't slacking?

Slotos@feddit.nl · 2 pts · 2y

Monitor the room temperature.

llothar@lemmy.ml · 43 pts · 2y (3 replies)

tar -xzf stands for tar eXtract Ze Filez

kshade@lemmy.world · 7 pts · 2y

I like tar xaf (eXtract All Files) better.

01101000_01101001@mander.xyz · 6 pts · 2y

You can skip the z; tar is smart enough to figure it out on its own

Semi_Hemi_Demigod@lemmy.world · 2 pts · 2y
[ removed ]
brlemworld@lemmy.world · 40 pts · 2y (2 replies)

tar --help

JargonWagon@lemmy.world · 4 pts · 2y (1 reply)

That was my first thought too lol

grrgyle@slrpnk.net · 2 pts · 2y

Rofl me too twins

j4k3@lemmy.world · 34 pts · 2y (4 replies)

tar --version

WhoLooksHere@lemmy.world · 16 pts · 2y (3 replies)

Or is it -v

saigot@lemmy.ca · 21 pts · 2y

-v is verbose

tiredofsametab@kbin.run · 6 pts · 2y (1 reply)

Depends. Short options are probably safer if the particular version and flavor of tar are unknown.

0x4E4F@sh.itjust.works · 1 pts · 2y

So you either het version or verbose...slick AF 😏.

Zos_Kia@lemmynsfw.com · 33 pts · 2y (1 reply)

There's an easy mnemonic for that : Compress Ze Vucking File !

synapse1278@lemmy.world · 10 pts · 2y

Always think about tar commands in your best German accent !

elrik@lemmy.world · 27 pts · 2y (5 replies)

How does it verify the command is valid? Does it run what I enter?

If so, just give it an infinite loop followed by some attempt at a tar command:

while true; do :; done; tar -xyz
velvetThunder@lemmy.zip · 35 pts · 2y (1 reply)

Next time I build a bomb I let the timer continue while the command is running.

Voroxpete@sh.itjust.works · 15 pts · 2y

Yeah, what kind of idiot doesn't parallelize their timer function.

mlg@lemmy.world · 26 pts · 2y

Blue Team: "Okay everyone let's make sure this is absolutely the correct input"

Red Team: "Lmao lets try this 90mb list of bash command injection patterns"

lseif@sopuli.xyz · 2 pts · 2y (1 reply)

i assume its looking for exit code of 0

lseif@sopuli.xyz · 2 pts · 2y

echo || tar -xfzhd

samus12345@lemmy.world · 22 pts · 2y (3 replies)

I'd like to know if there are any XKCDs that are no longer relevant.

xorollo@leminal.space · 7 pts · 2y (1 reply)
[ removed ]
DerisionConsulting@lemmy.ca · 4 pts · 2y

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.

Faresh@lemmy.ml · 1 pts · 2y

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 the xf part.

atx_aquarian@lemmy.world · 19 pts · 2y (3 replies)

I hitched my horse to just what I consider the basics--zip and unzip--and that has made it easy for me. But I've been stuck on those.

Extract anything:

tar xf <archive_file>

Create a tbz2 archive:

tar cjf <archive_file.tbz2> <stuff to put in it>

(And tossing in a -v is pretty universal, if that's your thing.)

Some day, instead of commenting on a reddit Lemmy post, I think I'll Google how to tell it to use .xz.

Ok, you know what? Today is finally that day. It's just capital -J instead of lower-case -j! That's easy enough to remember, I guess.

partial_accumen@lemmy.world · 14 pts · 2y

Stay by the phone always. We may need you to defuse a bomb someday.

governorkeagan@lemdro.id · 9 pts · 2y (1 reply)

Never thought I'd learn how to use tar on a meme post.

0x4E4F@sh.itjust.works · 3 pts · 2y

Memes are one of the best source for Linux info 👍.

UnculturedSwine@lemmy.world · 18 pts · 2y

tar -cvzf /etc/

Edit: we're dead :(

tisktisk@monero.town · 16 pts · 2y (8 replies)

tar -xvf or we all kill

lseif@sopuli.xyz · 9 pts · 2y (6 replies)

shouldnt there be a filename argument ?

Enfors@lemm.ee · 5 pts · 2y (3 replies)

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

barsoap@lemm.ee · 3 pts · 2y (2 replies)

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 can bunzip2 foo.tar.bz2 | tar xf - or such in a portable manner, don't have to rely on tar having a z option (which is nonstandard) or it auto-detecting compression (even more nonstandard). What is not standard either is tar -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 as dd, you can interpret how tar does things in the same way as git pull: It's a subcommand, not a flag.

tisktisk@monero.town · 1 pts · 2y (1 reply)

"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

barsoap@lemm.ee · 2 pts · 2y

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.

tisktisk@monero.town · 2 pts · 2y (1 reply)

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

lseif@sopuli.xyz · 1 pts · 2y

tar -czf $(ls | head -n1) if we dont trust globs

or run find in /bin or something

recapitated@lemmy.world · 6 pts · 2y

ya blew it kid

umbraroze@lemmy.world · 16 pts · 2y (6 replies)

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 and tar -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?

ben@feddit.dk · 5 pts · 2y (1 reply)

I didn't even know the dash was optional. I guess you learn something new everyday.

MehBlah@lemmy.world · 2 pts · 2y

I still use it though. Its how I learned it all those years ago and its ingrained as muscle memory when typing the command.

vox@sopuli.xyz · 2 pts · 2y (1 reply)

idk if it's optional why bother typing it

lseif@sopuli.xyz · 9 pts · 2y

personally, it is a little easier to read, especially in a script. and its more consistent with other commands

barsoap@lemm.ee · 2 pts · 2y

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 in tar xvf to be a subcommand as pull is in git pull. Tar simply has a fancy subcommand syntax. At least it's not dd.

debil@lemmy.world · 2 pts · 2y

No idea, but with tar I never use dashes. Just tar xf away.

MyFairJulia@lemmy.world · 15 pts · 2y (1 reply)

Remember: Just tell tar to Xtract Z File.

holgersson@lemm.ee · 13 pts · 2y

Xtract gZipped File

m4@kbin.social · 15 pts · 2y (5 replies)

I just can recall tar xvzf but can't even remember what it's supposed to do.

Hawke@lemmy.world · 29 pts · 2y (4 replies)

eXtract, Verbose, gZip, File.

Not sure why it doesn’t need the dash though.

d00phy@lemmy.world · 16 pts · 2y (1 reply)

The dash used to be how to could tell how long someone had been using tar. If they started with Linux, they probably use a dash. If they started on a UNIX variant, they probably don’t. Either way, the dash isn’t needed.

Also recently learned that recent versions of tar will autodetect compression. So for extraction, you just need “tar xf “

Hawke@lemmy.world · 5 pts · 2y

Sacrilege.

r4venw@kbin.social · 14 pts · 2y

I always learnt it as Xtract Zee File and to make a tar ball, you want to Compress Zee File

best_username_ever@sh.itjust.works · 1 pts · 2y

tar doesn’t need dashes because it’s weird.

boredsquirrel@slrpnk.net · 12 pts · 2y (4 replies)

I guess man tar is cheating, but it is a command involving tar. Not a command using tar, but a tar command...

neoman4426@fedia.io · 13 pts · 2y (1 reply)

I suppose tar --help would technically be a valid invoking of the binary itself if man tar doesn't

Emma_Gold_Man@lemmy.dbzer0.com · 3 pts · 2y

But it would not work on older non-GNU versions of tar.

GNU introduced the "--foo" style long options, and it was a long time before Unix versions began adopting them.

bradorsomething@ttrpg.network · 2 pts · 2y (1 reply)

It didn’t say you could only enter one try, just that you had 10 seconds. The man page should give you something

boredsquirrel@slrpnk.net · 1 pts · 2y

True. But then I would use curl cheat.sh/tar

FuglyDuck@lemmy.world · 10 pts · 2y

Sudo halt -fn

Emerald@lemmy.world · 10 pts · 2y (1 reply)

tar -xzvf file.tar

alyth@lemmy.world · 1 pts · 2y
[ removed ]
arc@lemm.ee · 9 pts · 2y (3 replies)

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.

flying_sheep@lemmy.ml · 6 pts · 2y (2 replies)

Why remember/include the algorithm? Tar can infer that. It's just bsdtar xf filename.* for everything. (bsdtar handles .zip as well)

Samsy@lemmy.ml · 2 pts · 2y (1 reply)

The bomb said tar.

flying_sheep@lemmy.ml · 1 pts · 2y

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 also tar.

Barzaria@lemmy.dbzer0.com · 8 pts · 2y

tar

eya@lemmy.dbzer0.com · 8 pts · 2y (1 reply)

tar cJf file.tar.xz /path/to/file

tar xJf file.tar.xz /path/to/file.tar.xz -C /path/to/untar

is not very hard to remember

LainTrain@lemmy.dbzer0.com · 6 pts · 2y

Unless you use it daily, I think that's something I'd struggle with memorising, I'd just alias it tbh along with ls options

PoolloverNathan@programming.dev · 7 pts · 2y (1 reply)

tar x

johannesvanderwhales@lemmy.world · 5 pts · 2y

tar --help

gandalf_der_12te@discuss.tchncs.de · 7 pts · 2y (3 replies)

tar -cf file.tar directory/

gandalf_der_12te@discuss.tchncs.de · 6 pts · 2y (2 replies)

that was 8 seconds. close one, i saved us all

fonji@sopuli.xyz · 2 pts · 2y (1 reply)

How do you know directory exists? 😨

FiskFisk33@startrek.website · 7 pts · 2y

tar --help

bradorsomething@ttrpg.network · 7 pts · 2y (2 replies)

| man tar

faerbit@sh.itjust.works · 9 pts · 2y (1 reply)

This is a valid man command, but not a tar command

bradorsomething@ttrpg.network · 2 pts · 2y

I’ll use the man page to find a command; it said 10 seconds, not 1 try!

xkforce@lemmy.world · 6 pts · 2y (2 replies)

Do people not use tab complete?

Voroxpete@sh.itjust.works · 5 pts · 2y (1 reply)

Found the person who's never used tar :-P

xkforce@lemmy.world · 1 pts · 2y
  1. Thats not true and
  2. I am fully aware that there are 127 flags. That just makes this even sillier because you have so many valid options to disarm the bomb.
MehBlah@lemmy.world · 6 pts · 2y

tar -zxvf yourmom.tgz /home/xkcd/yourmomnude/* This was wrong. I intended to be creating a file -zcvf.

Magister@lemmy.world · 5 pts · 2y

tar, the tape archiver, I used it with tape, early 90s

linearchaos@lemmy.world · 4 pts · 2y

I've never had a problem remembering tar, but properly using PV, somehow I'm just not able to store that information in my brain.

Steamymoomilk@sh.itjust.works · 4 pts · 2y

I just use ouch

EuroNutellaMan@lemmy.world · 3 pts · 2y

I memorized tar -cavf file.tar.bz2 directory/* and tar -xavf file.tar.bz2

gravitas_deficiency@sh.itjust.works · 3 pts · 2y

The fact that this thread contains, like, TONS of invalid invocations that people have been editing for correctness is fucking hilarious.

Also, QED 🤠

lambda@programming.dev · 2 pts · 2y

tar --extract --file file.tar.gz

grrgyle@slrpnk.net · 2 pts · 2y

All those years of using nautilus have made me weak

LazerFX@sh.itjust.works · 2 pts · 2y

I always remember that it's eXtract Ze File, tar -xzf... But I'll be honest, I've not used it in years and years

mdurell@lemmy.world · 2 pts · 2y

cpio is way worse

tsonfeir@lemm.ee · 2 pts · 2y

Anyone else make an untar.sh?

Korbs@lemmy.world · 1 pts · 2y

Well, bye everyone.

AffineConnection@lemmy.world · 1 pts · 2y

Now do a standard pax command.

Titou@sh.itjust.works · 1 pts · 2y

Tar -xvf

Badabinski@kbin.earth · 1 pts · 1y
touch foo; tar cvf foo.tar foo

My fucking autocorrect decided that cvf should have been xvf. I caught it before I hit enter to close out the code block, but wtf? When did my keyboard develop opinions on command args‽