1. 17
  1.  

  2. 8

    oh man, I built almost the same site years ago - https://tarbz2.com

    1. 6

      I’ll have forgotten this url before I forget xvf and cvf… What was wrong with tar --help and man tar?

      1. 5

        What about other compression algos like bzip2 or xz? Learning this stuff by rote will leave you in a pickle when you get an uncompressed archive, or something more exotic than gzip.

        1. 5

          Yeah. A simpler and more versatile method frequently available is tar -xf thefile and it’ll just figure it out.

          1. 6

            There’s also the -a option to automatically determine the compressor to use based on the output filename. For example, tar caf myarchive.tar.bz2 ..

            Supported by GNU tar and FreeBSD’s tar at least, but not OpenBSD’s tar for one.

            1. 5

              There is also dtrx (“do the right extraction”), it work with all kind of formats

              1. 1

                Oh, I wasn’t aware of that

            2. 2

              I disagree. I think cheat sheets are a great way to bootstrap yourself into productivity. You can always take the formula you’ve learned and RTFM to gain more depth.

              1. 5

                Hmm, I’m generally opposed to rote learning of any kind because while it might give you enough to ‘get along’ you’ll never master anything without understanding.

                Particularly with computing, understanding (more-or-less) what you’re doing takes a little more effort but yields great rewards.

                That’s not to say all cheat sheets are evil, there are some things which must be learned — I just don’t think this one is very good.

                1. 1

                  I agree that this cheat sheet is not amazing.

                2. 2

                  Are man pages dead?

                  Using the shell to extract files should mean it’s faster to rtfm than dig online. With a case as simple as this, learning through man or --help should be so fast there’s no need for a page like this.

                  Cheat sheets should come with “See also” references anyway.

              2. 3

                tar xf <file> is portable (GNU, BSD, OSX) and does the right thing™

                1. 4

                  The definition of the Right Thing differs per platform. On OpenBSD tar -xf will tell you which flag to use but doesn’t extract. IMO that’s the Right Thing for OpenBSD, but it’s understandable that other platforms choose to just do it automatically.

                  $ tar -xf foo.tar.bz2
                  tar: End of archive volume 1 reached
                  tar: input compressed with bzip2; use the -j option to decompress it
                  
                2. 2

                  I’m using a command from atoolaunpack. For example, aunpack archive.tar will unpack the archive. It works with cpio, rar, zip, I think also rpm, and other stuff as well.

                  As for tar, I remember it as: extraction tar zxf <file> -C <dir> – zxf is very easy to remember, as for compression: tar zcf, very similar to zxf because c is right next to x on a qwerty layout which I use, so easy to remember as well.

                  1. 1

                    I was hoping this was going to be something like explain shell for tar.

                    1. 1

                      How I remember the untar command: tar Xtract Ze Files => tar xzf

                      1. [Comment removed by author]

                        1. 1
                          gunzip -c SRCFILE.tar.gz
                          

                          Why not just use zcat? :)

                          1. 2

                            zcat ist a shell script calling gunzip

                            1. 1

                              A month late, but that depends on the system ;):

                              ~ % file /usr/bin/zcat
                              /usr/bin/zcat: Mach-O 64-bit executable x86_64
                              
                          2. 1

                            You don’t need the -f if the argument is stdin.

                            1. 3

                              You do, because tar’s behavior is not portable. On OpenBSD, for example, if -f is omitted then tar defaults to /dev/rst0 (a tape drive).

                          3. 1

                            How long ago did you put this up?

                            1. 3

                              right before posting here

                            2. -2

                              Who pays $10 a year for this domain? Kind of an odd thing to care about.

                              1. 3

                                The OP, in fact. $10 isn’t much for a interesting little side project or help page like this if it gets any traction.

                                1. 3

                                  Yeah, I just felt like it. Not gonna make me go bankrupt :)