this post was submitted on 10 Nov 2024
119 points (87.0% liked)

Linuxsucks

183 readers
87 users here now

Rules:

  1. FOSS advocates and Linux evangelists aren't welcome. -We ask that you block us.
  2. Moderation is heavy handed. Try to stay on topic.
  3. No Complaining Mute the sub if users, content, or rules bother you

founded 1 month ago
MODERATORS
 

Bonus question: With or without - ?

all 46 comments
sorted by: hot top controversial new old
[–] JackGreenEarth@lemm.ee 45 points 2 weeks ago (4 children)
[–] PM_Your_Nudes_Please@lemmy.world 20 points 2 weeks ago

tar -help

Wait no fuc-
#BOOM

[–] superkret@feddit.org 11 points 2 weeks ago

The coward's way out

[–] credo@lemmy.world 3 points 2 weeks ago (1 children)

See, I would have man tar’d, and died.

[–] Gladaed@feddit.org 3 points 2 weeks ago

That's on you. You were supposed to input a tar and not a man command

[–] superkret@feddit.org 16 points 2 weeks ago* (last edited 2 weeks ago) (2 children)

When I point an (un)packing program at a packed archive, the default action should be to fucking unpack it.
And when I point it at anything else, it should pack it into the default format.

Everything else can be options.

[–] laurelraven@lemmy.zip 9 points 2 weeks ago (1 children)

The problem is, tar isn't a packing program, it's a tape archive program that's been repurposed for general files-to-file archival with optional compression plugins

At this point, if it were written today, it probably would behave as you suggest, but changing it now would break too many things that use it

[–] superkret@feddit.org 6 points 2 weeks ago

Then it would've been time to deprecate it for this purpose, and use something sensible instead, say about 13 years ago.
All the old stuff can then keep using tar, but the nicer option can become the standard for user-friendly file extraction.

[–] rtxn@lemmy.world -3 points 2 weeks ago* (last edited 2 weeks ago) (2 children)

"The world should conform to my expectations, not long-standing conventions!"

But if you engage your thinking meat, you might just discover the magic of alias untar='tar xvf'.

[–] superkret@feddit.org 11 points 2 weeks ago* (last edited 2 weeks ago) (2 children)

"long-standing conventions" is how you end up with Internet Explorer still pre-installed on Windows Server 2025.
And when was the last time you used the tar "tape archiver" to archive things on tape?

[–] rtxn@lemmy.world 11 points 2 weeks ago (1 children)

Magnetic tapes are still being used as long-term storage, as backups for example. They are inexpensive, compact, have zero moving parts, and are more durable than optical media. All you have to do is keep them in a location that is around room temperature, relatively dry, and away from magnets.

But that's not really what tar does. It simply collects the input files and writes them to a single contiguous data stream -- a file not unlike an actual tape. It's worked like that for, I shit you not, 45 years, and it is very much a single project holding up modern technology situation. I fear to imagine what would happen if it were to change.

[–] Steve@startrek.website 1 points 2 weeks ago (1 children)

What the fuck zero moving parts? Are you high?

[–] milicent_bystandr@lemm.ee 1 points 1 week ago

That would be the sticky tape. Also good for long term storage.

[–] corsicanguppy@lemmy.ca 4 points 2 weeks ago (1 children)

You may not have heard this, but tar can be used to work with non-tape archives.

In fact, non-tape archives are the overwhelmingly popular workflow.

[–] electricyarn@lemmy.world 0 points 2 weeks ago (1 children)

Does having to explain the history of a tool to understand why it works that way make it more or less useful?

[–] laurelraven@lemmy.zip 3 points 2 weeks ago

Neither, but understanding that and the ubiquity of that tool might help understand why it can't simply be changed

[–] pinkystew@reddthat.com -3 points 2 weeks ago (1 children)

Why are long standing conventions a good thing? Slavery was a longstanding convention.

[–] laurelraven@lemmy.zip 4 points 2 weeks ago

No human rights are violated by tar functioning the way it does, but changing it would cause a lot of problems without good reason since you could just as easily write an alias or wrapper to simplify the usage

[–] cholesterol@lemmy.world 11 points 2 weeks ago (1 children)
[–] fraksken@infosec.pub 1 points 1 week ago
[–] Hobbes_Dent@lemmy.world 10 points 2 weeks ago (1 children)
[–] fraksken@infosec.pub 2 points 1 week ago

xvzf would extract, verbose, unzip file [filename]

[–] SelfProgrammed@lemmy.world 6 points 2 weeks ago

dtrx = Do The Right eXtraction

Check your local package manager

[–] DavidGarcia@feddit.nl 5 points 2 weeks ago

tar -xzyzrzwzucuauazdufsomething

[–] slazer2au@lemmy.world 5 points 2 weeks ago (1 children)

Tar --rfx

Welpi failed. R isn't valid in this context.

[–] Sc00ter@lemm.ee 2 points 2 weeks ago (1 children)

Shit r was mine too. Thought it was recursive

[–] fraksken@infosec.pub 1 points 1 week ago (1 children)
[–] slazer2au@lemmy.world 2 points 1 week ago (1 children)

r adds files to an existing compressed file.

So we are saying add a file (r), target this file (t), extract this file (x)

[–] fraksken@infosec.pub 2 points 1 week ago

Thank you for that insight :)

[–] GissaMittJobb@lemmy.ml 4 points 2 weeks ago

xvf/zcfv

Xtract/Create

[–] twinnie@feddit.uk 3 points 1 week ago (2 children)

tar -xvf filename I don’t even know what it does but I’ve memorised it.

[–] fraksken@infosec.pub 2 points 1 week ago

x for extract v is verbose f for file input

[–] milicent_bystandr@lemm.ee 1 points 1 week ago

-zxf for me, I've mostly used it on gzipped archives

[–] model_tar_gz@lemmy.world 3 points 1 week ago (1 children)
[–] Muehe@lemmy.ml 2 points 1 week ago
$ tar -h; echo $?
tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options
Try 'tar --help' or 'tar --usage' for more information.
2
$

Lemon squeezy.

[–] rc__buggy@sh.itjust.works 3 points 2 weeks ago (1 children)
[–] superkret@feddit.org 9 points 2 weeks ago (1 children)

tar: Refusing to read archive contents from terminal (missing -f option?)

BOOM

[–] corsicanguppy@lemmy.ca 3 points 2 weeks ago

In every tar: xf .

Although I do admit looking for 'gtar' and using it first. #onlyUnixUsersGetIt

[–] Aganim@lemmy.world 2 points 2 weeks ago

The real question: GNU tar or not?

[–] madthumbs@lemmy.world 2 points 2 weeks ago

I remember using a script as a solution, so I'd be a gonner!

[–] Steamymoomilk@sh.itjust.works 2 points 2 weeks ago

This is why i always install ouch. Tar is for course brain

[–] MehBlah@lemmy.world 1 points 2 weeks ago (1 children)

This one would be no problem.

[–] superkret@feddit.org 5 points 2 weeks ago (1 children)

Do you know which version of tar it is?
Unix or GNU/Linux?

[–] MehBlah@lemmy.world 4 points 2 weeks ago

Just use - in the statement to cover your bases.