Old XKCD, still relevant
Old XKCD, still relevant
Was trying to extract a totally legit copy of Skate 3 I downloaded today to play on my Steam Deck
Old XKCD, still relevant
Was trying to extract a totally legit copy of Skate 3 I downloaded today to play on my Steam Deck
tar --help
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.
Boom. tar --help
for anyone wondering
tar -czvf tar_name.tar.gz ./
File not found, now we are dead.
Sounds like an error message from a valid tar command
tar --version
You're welcome
Sorry, the bomb was running MacOS. Your command was not valid and you've doomed us all.
It's literally there at the bottom.
What isn't valid is MacOS, it's macOS now.
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!
tar --version
Read my mind. :D
tar -xzf stands for tar eXtract Ze Filez
I like tar xaf
(eXtract All Files) better.
You can skip the z; tar is smart enough to figure it out on its own
tar --help
That was my first thought too lol
Rofl me too twins
There's an easy mnemonic for that : Compress Ze Vucking File !
Always think about tar commands in your best German accent !
How does it verify the command is valid? Does it run what I enter?
If so, just give it an infinite loop followed by some attempt at a tar command:
while true; do :; done; tar -xyz
Next time I build a bomb I let the timer continue while the command is running.
Yeah, what kind of idiot doesn't parallelize their timer function.
Blue Team: "Okay everyone let's make sure this is absolutely the correct input"
Red Team: "Lmao lets try this 90mb list of bash command injection patterns"
i assume its looking for exit code of 0
echo || tar -xfzhd
I'd like to know if there are any XKCDs that are no longer relevant.
There are some that were wrong to begin with, I remember 622 bothering me.
https://xkcd.com/622/
But it could also just be that in the comic, the professor is wrong.
This one, if by unix he also means modern linux systems. Nowadays you can simply use tar xf my-file.tar.whatever
and it should work on most linux systems (it worked on every modern linux system I've tried and every compressed tar file I've tried). I don't think it is hard to remember the xf
part.
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.
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 👍.
tar -cvzf /etc/
Edit: we're dead :(
tar -xvf or we all kill
shouldnt there be a filename argument ?
Yes. However, if you had skipped the -f, it would have been valid. Without the filename argument, it assumes it should extract from the tape drive (TAR = Tape ARchive). The tape device is probably something like /dev/rmt0, but you don't need to specify that. Using the -f is technically an exception which means "instead of extracting from the tape like you'd normally do, pretend that this file is the tape device instead."
ya blew it kid
Actually this reminds me, what is the deal with tar command recommendations to use or not use dash? I know GNU tar accepts both (e.g.) tar xvf file.tar
and tar -xvf file.tar
, but at some points people were like "NO! Don't use the dash! It's going to maybe cause issues somewhere, who knows!" and I was like "OK". Something to do with people up designing the Unix specs?
I didn't even know the dash was optional. I guess you learn something new everyday.
I still use it though. Its how I learned it all those years ago and its ingrained as muscle memory when typing the command.
POSIX. POSIX didn't get designed but documented behaviour that was portable between different UNIX flavours and was then declared a standard.
If you're annoyed by it just consider the xvf
in tar xvf
to be a subcommand as pull
is in git pull
. Tar simply has a fancy subcommand syntax. At least it's not dd
.
idk if it's optional why bother typing it
personally, it is a little easier to read, especially in a script. and its more consistent with other commands
No idea, but with tar I never use dashes. Just tar xf away.
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.
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 “
I always learnt it as Xtract Zee File and to make a tar ball, you want to Compress Zee File
tar doesn’t need dashes because it’s weird.
Remember: Just tell tar to Xtract Z File.
Xtract gZipped File
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
Sudo halt -fn
tar -xzvf file.tar
That's what I had in mind too. Tar's arguments are really intuitive.
x - eXtract
z - use gZip
v - Verbose
f - File (requires the path as an argument)
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
tar --help
tar x
tar --help
| man tar
This is a valid man
command, but not a tar
command
I’ll use the man page to find a command; it said 10 seconds, not 1 try!
Do people not use tab complete?
Found the person who's never used tar :-P
tar -zxvf yourmom.tgz /home/xkcd/yourmomnude/* This was wrong. I intended to be creating a file -zcvf.
tar, the tape archiver, I used it with tape, early 90s
I just use ouch
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.
The fact that this thread contains, like, TONS of invalid invocations that people have been editing for correctness is fucking hilarious.
Also, QED 🤠
I memorized tar -cavf file.tar.bz2 directory/* and tar -xavf file.tar.bz2
Anyone else make an untar.sh?
cpio is way worse
All those years of using nautilus have made me weak
tar --extract --file file.tar.gz
I always remember that it's eXtract Ze File, tar -xzf
... But I'll be honest, I've not used it in years and years
Well, bye everyone.
Tar -xvf
touch foo; tar cvf foo.tar foo
My fucking autocorrect decided that cvf
should have been xvf
. I caught it before I hit enter to close out the code block, but wtf? When did my keyboard develop opinions on command args‽
Now do a standard pax
command.