There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

LazerFX ,

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

Titou ,
@Titou@sh.itjust.works avatar

Tar -xvf

tisktisk ,

tar -xvf or we all kill

lseif ,

shouldnt there be a filename argument ?

Enfors ,
@Enfors@lemm.ee avatar

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 , (edited )

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 ,

“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 , (edited )

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 ,

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 ,

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

or run find in /bin or something

recapitated ,

ya blew it kid

AffineConnection ,

Now do a standard pax command.

gandalf_der_12te ,

tar -cf file.tar directory/

gandalf_der_12te ,

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

fonji ,

How do you know directory exists? 😨

gandalf_der_12te ,

shit

doggle ,

tar --version

You’re welcome

bitwaba ,

I’d have gone with tar --help

flying_sheep ,
@flying_sheep@lemmy.ml avatar

It’s insane that this isn’t consistent.

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

FMEEE ,

So would have been 1:4

zaphod ,

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

flying_sheep ,
@flying_sheep@lemmy.ml avatar

One example for it is … tar!

www.man7.org/linux/man-pages/man1/tar.1.html

zaphod ,

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

Aganim ,

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

Andrew15_5 ,

It’s literally there at the bottom.

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

FiskFisk33 ,

tar --help

Korbs ,
@Korbs@lemmy.world avatar

Well, bye everyone.

gravitas_deficiency ,

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

Also, QED 🤠

prettybunnys ,

tar -czvf tar_name.tar.gz ./

rockSlayer ,

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

thejml , (edited )

tar xzvf this_awesome_file.tgz

… fixed. Apparently I can’t type.

hallettj ,
@hallettj@leminal.space avatar

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_ ,

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 ,

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

gravitas_deficiency ,

QED 🫠

Aurenkin ,

File not found, now we are dead.

prettybunnys ,

Sounds like an error message from a valid tar command

v_krishna ,
@v_krishna@lemmy.ml avatar

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 ,

Read it in tf2 medics voice

Edgarallenpwn ,
@Edgarallenpwn@midwest.social avatar

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

gravitas_deficiency ,

lol that’s honestly a great mnemonic

arc ,

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 ,
@flying_sheep@lemmy.ml avatar

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

Samsy ,

The bomb said tar.

flying_sheep ,
@flying_sheep@lemmy.ml avatar

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.

PoolloverNathan ,

tar x

johannesvanderwhales ,

tar --help

Emerald ,

tar -xzvf file.tar

alyth ,

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)

lambda ,
@lambda@programming.dev avatar

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

grrgyle ,

All those years of using nautilus have made me weak

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines