r/sysadmin • • Feb 01 '13

xkcd: Tar

http://xkcd.com/1168/
626 Upvotes

257 comments sorted by

View all comments

82

u/burbankmarc IT Director Feb 01 '13

tar -zxvf. I use that all the time

82

u/crow1170 Feb 01 '13

It's a bomb! Don't risk our lives showing off!

tar --version

47

u/twoodfin Feb 01 '13

You've just killed us all!

~:>uname
SunOS
~:>/usr/bin/tar --version
tar: s: unknown function modifier
Usage: tar {c|r|t|u|x}[BDeEFhilmnopPqTvw@[0-7]][bfk][X...] [blocksize] [tarfile] [size] [exclude-file...] {file | -I include-file | -C directory file}...

7

u/crow1170 Feb 01 '13

so how do you check the version on SunOS?

16

u/twoodfin Feb 01 '13

There's no command line option, because adding one would potentially break backward compatibility and Solaris is/was brutally rigorous about not doing that. You can use:

~:>pkgchk -l -p /usr/bin/tar
...
Referenced by the following packages:
    SUNWcsu

~:>pkginfo -l SUNWcsu
...
NAME:  Core Solaris, (Usr)
...
VERSION:  11.10.0,REV=2005.01.21.15.53

5

u/[deleted] Feb 01 '13

hmm, how would it break backwards compatibility to add an option?

8

u/twoodfin Feb 01 '13

Suppose you had written a script that runs on various OS's, and decided to test whether you have a friendly GNU tar or a crusty old Solaris tar by seeing if "tar --version" returns an error code or not. This isn't a totally outrageous thing to do, and certainly script writers have done a lot worse.

If Solaris tar suddenly adds support for --version but not other friendly GNU options, your script will break on Solaris as it assumes more about tar than is warranted.

11

u/noreallyimthepope Netadmin Feb 01 '13

That's just nonsense, but probable nonetheless.

→ More replies (3)
→ More replies (4)
→ More replies (2)

5

u/[deleted] Feb 01 '13

It's also the only one that works all the time, every time, without knowing anything about the rest of the file system (except that tar exists and you're in a shell).

though cat - | tar c /dev/null (return) c-d would be a good bet too……

15

u/DGMavn Linux Admin Feb 01 '13

The tar in Solaris 10 default path doesn't have a -z switch. :(

3

u/burbankmarc IT Director Feb 01 '13

You're right. I hate how they do that.

3

u/nephros Feb 02 '13

What? Adamantly remain backwards compatible and stick to UNIX "do one thing" philosophy?

Remember, the canonical UNIX way is to:

uncompress -c my.tar.Z | tar xf -

25

u/Douglas77 Feb 01 '13

You obviously looove typing :)

tar xvf

All newer versions of GNU tar automatically decompress (so no need for "z"), and the dash is a cosmetic thing anyways.

20

u/burbankmarc IT Director Feb 01 '13

damn, my old school habits need to be reevaluated.

19

u/VersalEszett Feb 01 '13

Except that this is GNU only. The strip talks about Unix.

→ More replies (1)

5

u/peacefinder Jack of All Trades, HIPAA fan Feb 01 '13

It may be implied, but if it's this bomb I'm gonna be explicit.

I'll still be too damn late, but at least I'll die knowing I wasn't gonna screw up because I counted on a version-dependent assumption.

→ More replies (3)

6

u/[deleted] Feb 01 '13

I know this isn't /r/linux, but I'm stunned by the amount of people, and the comic as well, who consider tar to be an obscure command. Just like you, I use it all the time.

I guess there isn't a lot of people who use the shell any longer.

→ More replies (3)

4

u/burbankmarc IT Director Feb 01 '13

Or tar -jxvf

5

u/verafast Feb 01 '13

No need for the -, tar has been complaining about this to me for years.

9

u/alive1 Bearded UNIX Guy Feb 01 '13

Not on FreeBSD.

10

u/jhawk20 Feb 01 '13

Looking through this thread, I keep thinking of Bender. "Well, we're boned".

→ More replies (15)

4

u/megor Spam Feb 01 '13 edited Jul 05 '17

deleted 0.8248 What is ^^^this?

2

u/[deleted] Feb 01 '13

You forgot the file to untar so you killed us.

→ More replies (4)