Old XKCD, still relevant - Divisions by zero

Was trying to extract a totally legit copy of Skate 3 I downloaded today to play on my Steam Deck

tar --version
Or is it -v
Depends. Short options are probably safer if the particular version and flavor of tar are unknown.
So you either het version or verbose…slick AF šŸ˜.

I hitched my horse to just what I consider the basics–zip and unzip–and that has made it easy for me. But I’ve been stuck on those.

Extract anything:

tar xf <archive_file>

Create a tbz2 archive:

tar cjf <archive_file.tbz2> <stuff to put in it>

(And tossing in a -v is pretty universal, if that’s your thing.)

Some day, instead of commenting on a reddit Lemmy post, I think I’ll Google how to tell it to use .xz.

Ok, you know what? Today is finally that day. It’s just capital -J instead of lower-case -j! That’s easy enough to remember, I guess.

Create a tar.xz in one command

I am trying to create a .tar.xz compressed archive in one command. What is the specific syntax for that? I have tried tar cf - file | xz file.tar.xz, but that does not work.

Stack Overflow
Stay by the phone always. We may need you to defuse a bomb someday.
Never thought I’d learn how to use tar on a meme post.
Memes are one of the best source for Linux info šŸ‘.
I guess man tar is cheating, but it is a command involving tar. Not a command using tar, but a tar command…
I suppose tar --help would technically be a valid invoking of the binary itself if man tar doesn't

But it would not work on older non-GNU versions of tar.

GNU introduced the ā€œā€“fooā€ style long options, and it was a long time before Unix versions began adopting them.

It didn’t say you could only enter one try, just that you had 10 seconds. The man page should give you something
True. But then I would use curl cheat.sh/tar
I just can recall tar xvzf but can't even remember what it's supposed to do.

eXtract, Verbose, gZip, File.

Not sure why it doesn’t need the dash though.

I always learnt it as Xtract Zee File and to make a tar ball, you want to Compress Zee File

The dash used to be how to could tell how long someone had been using tar. If they started with Linux, they probably use a dash. If they started on a UNIX variant, they probably don’t. Either way, the dash isn’t needed.

Also recently learned that recent versions of tar will autodetect compression. So for extraction, you just need ā€œtar xf ā€œ

tar doesn’t need dashes because it’s weird.

tar cJf file.tar.xz /path/to/file

tar xJf file.tar.xz /path/to/file.tar.xz -C /path/to/untar

is not very hard to remember

Unless you use it daily, I think that’s something I’d struggle with memorising, I’d just alias it tbh along with ls options
tar -czvf tar_name.tar.gz ./
Yep, have this one committed to memory. Though if it asked me to uncompress a tarball, then I’d be fucked
tar xcvf this_awesome_file.tgz
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

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.

Yeap, apparently I can’t type. So, we’d all be dead anyway with that bomb.
File not found, now we are dead.
Sounds like an error message from a valid tar command
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.
Read it in tf2 medics voice
I didn’t realize that was my default German voice in my head. Thx
lol that’s honestly a great mnemonic
Anyone else make an untar.sh?
tar, the tape archiver, I used it with tape, early 90s

Somehow, idk why. This one is stuck in my head:

tar -zxvf filename.tar.gz
tar xzvf eXtract Ze Vucking File
I have to do this command often at work and I can never remember the letters perfectly. This is actually useful, thanks!

Same, never used a mnemonic for it or anything, just

zxvf

Like it’s any other word

z=zip (default in most tar(, x=eXtract, v=verbose (not needed in most cases), f=target

verbose … not needed?

If the words don’t happen how can I trust computer magic?

Yeah, how do I know that the PC isn’t slacking?
Monitor the room temperature.
The bomb runs AIX. I’m sorry, you’re dead
tar zxvf filename.tar.gz file?
Nope, tar doesn’t handle compression on AIX. So it would be something like gzip -cd filename.tar.gz | tar xvf -
I’ve never had a problem remembering tar, but properly using PV, somehow I’m just not able to store that information in my brain.
Do people not use tab complete?
Found the person who’s never used tar :-P
  • Thats not true and
  • I am fully aware that there are 127 flags. That just makes this even sillier because you have so many valid options to disarm the bomb.
  • There’s an easy mnemonic for that : Compress Ze Vucking File !
    Always think about tar commands in your best German accent !
    tar -h
    Just tar, no arguments. Does nothing, still a valid command, no?
    Exit code 2 -> boom
    tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options Try 'tar --help' or 'tar --usage' for more information.