this post was submitted on 12 Mar 2024
759 points (99.0% liked)

Programmer Humor

32332 readers
81 users here now

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

Rules:

founded 5 years ago
MODERATORS
 

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

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 31 points 7 months ago

Surely tar --help is a valid tar command, right?

[–] [email protected] 12 points 7 months ago (1 children)

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

[–] [email protected] 1 points 7 months ago

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

[–] [email protected] 20 points 7 months ago

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.

[–] [email protected] 1 points 7 months ago

tar -h

I'll take my award in all ones please

[–] [email protected] 5 points 7 months ago

tldr tar | head -n 1

[–] [email protected] 12 points 7 months ago* (last edited 7 months ago)

I find it's a lot easier if you think of it in term of tapes, which is what it was originally designed for (Tape ARchiver). It's up there with makefiles for an actually really cool concept that nobody appreciates or even necessarily understands now.

(Well, I guess filesystems are the actual cool concept, from the historical perspective, but seeing the interplay with just tapes is the novel part to me)

[–] [email protected] 12 points 7 months ago (1 children)

What if i use bing instead of google

[–] [email protected] 16 points 7 months ago (2 children)
[–] [email protected] 7 points 7 months ago

To the boiler room of hell. Allll the way down.

[–] [email protected] 6 points 7 months ago

I think they're already there though

[–] [email protected] 22 points 7 months ago* (last edited 7 months ago) (1 children)

Normally I would say view the man page (as a command). Though for some reason when making the thinnest distro possible, the OS team at my job got rid of man.

Wtf man.

[–] [email protected] 8 points 7 months ago
[–] [email protected] 30 points 7 months ago* (last edited 7 months ago) (1 children)

I know this is a meme, but I actually find tar fairly easy to remember.

tar -xf $archive is extract file

tar -czf $archive dir/ is create zipped (compressed) file and the positional arguments are the files to add to the archive.

And this is 99% of my usage. You can skip -f $archive to use stdin/stdout or use -C to change directory (weird name but logically tar always extracts to the current directory). There is also a flag to list which I always forget and lookup each time, but I list much less often. -v is useful for verbose.

Overall there are much harder commands to remember. find always gets me if I go beyond -name. ps, tree and ls (beyond -Al) always get me to open the man page.

[–] [email protected] 10 points 7 months ago

There is also a flag to list which I always forget and lookup each time

That would be -t, which I tend to remember as "test", as in testing to see what is inside the archive!

tealdeer is a great program to have installed for easily getting a breakdown of the flags of pretty much any CLI app that at least I can ever think of!

[–] [email protected] 3 points 7 months ago (1 children)
[–] [email protected] 4 points 7 months ago

Or just double click.

[–] [email protected] 3 points 7 months ago

tar -xvf is the only one I know

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

[–] [email protected] 2 points 7 months ago

I always liked dtrx (do the right extraction)

[–] [email protected] 11 points 7 months ago

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

[–] [email protected] 75 points 7 months ago (1 children)

tar -xzvf archive.tar.gz

eXtract Zhe Vucking File

[–] [email protected] 42 points 7 months ago (2 children)

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

[–] [email protected] 12 points 7 months ago

Oh come on!

[–] [email protected] 9 points 7 months ago

Inadvertent oracle attack.

[–] [email protected] 81 points 7 months ago (2 children)
[–] [email protected] 3 points 7 months ago

This is the way

[–] [email protected] 4 points 7 months ago

Exactly what I would have done !

load more comments
view more: next ›