oh man, I built almost the same site years ago - https://tarbz2.com
I’ll have forgotten this url before I forget xvf and cvf… What was wrong with tar --help and man tar?
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.
Yeah. A simpler and more versatile method frequently available is tar -xf thefile and it’ll just figure it out.
tar -xf thefile
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 ..
tar caf myarchive.tar.bz2 .
Supported by GNU tar and FreeBSD’s tar at least, but not OpenBSD’s tar for one.
There is also dtrx (“do the right extraction”), it work with all kind of formats
Oh, I wasn’t aware of that
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.
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.
I agree that this cheat sheet is not amazing.
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.
tar xf <file> is portable (GNU, BSD, OSX) and does the right thing™
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
I’m using a command from atool – aunpack. 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.
tar zxf <file> -C <dir>
I was hoping this was going to be something like explain shell for tar.
How I remember the untar command:
tar Xtract Ze Files => tar xzf
[Comment removed by author]
gunzip -c SRCFILE.tar.gz
Why not just use zcat? :)
zcat ist a shell script calling gunzip
A month late, but that depends on the system ;):
~ % file /usr/bin/zcat
/usr/bin/zcat: Mach-O 64-bit executable x86_64
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).
How long ago did you put this up?
right before posting here
Who pays $10 a year for this domain? Kind of an odd thing to care about.
The OP, in fact. $10 isn’t much for a interesting little side project or help page like this if it gets any traction.
Yeah, I just felt like it. Not gonna make me go bankrupt :)