source

img title=“I don’t know what’s worse–the fact that after 15 years of using tar I still can’t keep the flags straight, or that after 15 years of technological advancement I’m still mucking with tar flags that were 15 years old when I started.”

tar -h

I’ll take my award in all ones please

Ephera
link
fedilink
119M

At some point, I realized tar xf is enough for extracting a file, so that’s what I’m always using now.

I just remember zxvf, but if I have to do anything else then extract a tar.gz we’re fucked.

If you can’t tar to a pipe into ssh to a remote host and untar into an arbitrary location there, are you really using Unix?

LostXOR
link
fedilink
29
edit-2
9M

I had to pipe dd through gzip over SSH recently to locally image a disk on a cloud server. That was fun.

What the fuck lmao I didn’t know that was possible

Wouldn’t tar --help suffice? Afaik, it returns exit code 0.

Depends. Is it GNU tar, BSD tar or some old school Unix tar?

Double hyphen “long options” are a typical GNU thing.

tar -h?

DefederateLemmyMl
link
fedilink
English
35
edit-2
9M
~# tar -h
tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options
Try 'tar --help' or 'tar --usage' for more information.
***********************************************
WARNING: Self destruct sequence initiated
***********************************************

Ugh. Bsdtar:

-h (c and r modes only) Synonym for -L.

But it has --help too.

~# tar -h || tar --help
paraphrand
link
fedilink
English
139M

That’s why those commands have two?

DefederateLemmyMl
link
fedilink
English
119M

Yes, the terse Unix version, which needs to be supported for compatibility, and the more readable GNU long option

Krafty Kactus
link
fedilink
English
1109M

A little trick I learned on here was to imagine yourself as a little evil man saying “Extract ze files!” in a German accent. Extract ze files >>> xzf.

Tb0n3
link
fedilink
English
259M

Only works for tar.gz. Remember there’s also tar.xz, tar.bz, tar.bz2 and half have their own extractor flag. FUN. It’s usually J.

Zagorath
link
fedilink
259M

The post only calls for “a valid tar command”, not that it has to work for any specific circumstance.

I don’t remember the last time I had to worry about the compression. I simply run tar xf myfile.tar.whatever and it works every time.

xigoi
link
fedilink
139M

xaf (extract a file) auto-detects the format.

Extract Any File

Extract All Files

arthurpizza
link
fedilink
English
39M

I still use that. 😅

Ziixe
link
fedilink
79M

That sounds a lot like Czech, “ze” means “from” if you translate it into English

Looks, not sounds. Ahoj!

@Blackmist@feddit.uk
link
fedilink
English
819M

tar --help

Aurelian
link
fedilink
English
49M

Exactly what I would have done !

This is the way

I wish more people knew about dtrx (Do The Right eXtraction).

Deebster
link
fedilink
English
69M

I didn’t know about -d.

explainshell.com to the rescue!

They meant the command dtrx, the combination of dtrx as parameters to tar make no sense. Extract AND append?

Deebster
link
fedilink
English
19M

haha, ok thanks. So https://github.com/dtrx-py/dtrx

I’d initially assumed that it was a mnemonic but yes, listing and appending and extracting together is nonsensical, as tar notes: tar: You may not specify more than one '-Acdtrux', '--delete' or '--test-label' option

Ayy Debian has been my main for like ten years. Dtrx is one of the ten things I apt immediately every time I have a re install

Or in this case, https://github.com/tldr-pages/tldr

And it’s fast implementation, https://github.com/dbrgn/tealdeer

👍Maximum Derek👍
link
fedilink
English
11
edit-2
9M

tar -tvf is a favorite of mine.

tar --help is a valid command

More of a request than a command, I’d have argued

I command you to show me the manual

@Aganim@lemmy.world
link
fedilink
19
edit-2
9M

For GNU tar it is, for any other version I would not be so sure. Especially when disabling an atomic bomb.

ɐɥO
link
fedilink
489M

I remember those 2 and thats all I need.
tar -extrakt ze file
tar -compress ze file

tar -extract -file

tar -compress -xz -file

tar -extract -any -file is easier, auto detect the compression based on filename.

exu
link
fedilink
English
79M

I think GNU tar automatically detects the compression, making -a unnecessary in that case.

And -z. tar -xf foo.tar.{gz,xz,zstd,...} will work perfectly fine.

Tar Xtract Ze Vucking File

Edit: apparently someone else already mentioned this, oops

Nope - it was Unix not Linux. The minus makes the command invalid on many Unix versions of tar (though most modern BSD versions allow it)

ɐɥO
link
fedilink
59M

Gonna blow up then I guess

tar -xvf is the only one I know

And I think it was tar -cvf for creating .tar files?

@SteveDinn@lemmy.ca
link
fedilink
English
209M

The command that I can never get right the first time is ln. I always end up creating a dead link inside my target folder, even when I read the man page directly prior.

tar xzvf file.tar.gz I got it memorized after installing gentoo over and over again from stage 3 back in 2005

Same, but it all goes to shit when I need to create an archive

tar -xzvf archive.tar.gz

eXtract Zhe Vucking File

Sorry, it was Solaris - you just blew it up (the minus is invalid on many Unix versions of tar)

Inadvertent oracle attack.

Oh come on!

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 9 users / day
  • 134 users / week
  • 418 users / month
  • 2.41K users / 6 months
  • 1 subscriber
  • 1.6K Posts
  • 35.6K Comments
  • Modlog