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

(page 2) 48 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 7 months ago

Btw, GNU tar has long options.

[–] [email protected] 30 points 7 months ago (5 children)

tar

Done. That's a valid command, no error code, nothing. KISS!

load more comments (5 replies)
[–] [email protected] 7 points 7 months ago

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

[–] [email protected] 48 points 7 months ago (5 children)

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

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

tar -extract -file

tar -compress -xz -file

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

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

load more comments (2 replies)
load more comments (3 replies)
[–] [email protected] 28 points 7 months ago (2 children)

man tar

“Yeah nvm, we’re fucked”

load more comments (2 replies)
[–] [email protected] 76 points 7 months ago (3 children)
[–] [email protected] 29 points 7 months ago (3 children)

Then comes a .tar.bz2 file along and you're screwed. xtract je vucking file?

Pro tip: -z, -j are not needed by tar anymore since many years, tar will autodetect what compression was used if your distro is anything remotely modern.

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

Pro tip: -z, -j are not needed by tar anymore since many years, tar will autodetect what compression was used if your distro is anything remotely modern.

😵

load more comments (2 replies)
[–] [email protected] 10 points 7 months ago (1 children)
[–] [email protected] 9 points 7 months ago
[–] [email protected] 5 points 7 months ago

I'm so proud of me when I remember this. Hackerman!

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

Yeah tar is easy. Regex on the other hand..

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

Oh jeez, I use regex at least 2-3 times a week. It's really not too bad for simple stuff and doing basic search and replace operations in text editors

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

Nothing a .* can't solve

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

I can remember regex, but I need to check tar almost every time.

load more comments (1 replies)
[–] [email protected] 12 points 7 months ago
[–] [email protected] 109 points 7 months ago (3 children)

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.

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

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

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

Looks, not sounds. Ahoj!

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

I still use that. 😅

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

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.

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

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

[–] [email protected] 6 points 7 months ago (1 children)
load more comments (1 replies)
[–] [email protected] 25 points 7 months ago

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

load more comments (1 replies)
[–] [email protected] 11 points 7 months ago* (last edited 7 months ago)

tar -tvf is a favorite of mine.

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

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

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

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

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

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

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

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

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

tar --help is a valid command

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

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

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

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

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

I command you to show me the manual

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

tar xvf somearchive.tar

Is that right? )= I'm scared I lost.

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

user@server:~> tar xvf somearchive.tar

tar: somearchive.tar: Cannot open: No such file or directory

tar: Error is not recoverable: exiting now

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

Scheiße...

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

Yep that's valid.

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

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

[–] [email protected] 49 points 7 months ago (5 children)

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

Double hyphen "long options" are a typical GNU thing.

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

That’s why those commands have two?

load more comments (1 replies)
load more comments (4 replies)
[–] [email protected] 51 points 7 months ago (2 children)

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?

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

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

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

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

load more comments (1 replies)
[–] [email protected] 8 points 7 months ago

tar -cvf CowsLookLikeMaps.tar CowsLookLikeMaps

load more comments
view more: ‹ prev next ›