Skip to content

Comment on Show HN: Extract it – Because nobody can remember tar commands

Comments

Why not just learn what the flags mean? If you're cargo culting it, and not learning the point of the "xfvz" (it means eXtract, from the specified File, with a Visual dump of the extraction, from a gZipped archived tarball) -- you'll never remember it.

"tar xvzf" is already a part of my muscle memory. Occasionally I need to change the "z" to a "j" for bzip2 archives. And the "x" becomes a "c" if I'm Creating an archive rather than eXtracting.

Also this site doesn't show the command for files with ".tgz" extensions.

tar xvzf" is already a part of my muscle memory. Occasionally I need to change the "z" to a "j" for bzip2 archives

With modern tar, just don't include the z at all. "tar -xf" knows how to extract various kinds of compressed tar files automatically.

Today I learned. I've been doing zxvf for quite a while and I always got annoyed with bz2 files.

Yeps. I used to have to keep googling whenever I wanted to extract something. Then I decided to learn what the flags meant and realised how easy it was. When doing the command it was a matter of saying it in head ("I am extracting from this gzipped file"). Likewise for compressing. Only difference being 'c' stood for Compressing.

You adding a lot of extra words, and there are many other options to tar, and you've left out making an archive, but yeah:

-cf Create File -xf eXtract File

then you have the adverb v, and the adjective z:

-vczf Verbosely Create gZip File -vxzf Verbosely eXtract gZip File

I find it difficult to remember the arguments mostly because I seldom use tar, not because the arguments are unintuitive or something.

no, "v" means verbose since at least 2.8 BSD: https://www.freebsd.org/cgi/man.cgi?query=tar&manpath=2.8+BS...

[deleted]

[deleted]

The f isn't for force. It's for "file" and it takes the filename as a parameter — that's why you usually see it at the end of the character sequence, a filename has to immediately follow it. If you don't specify -f tar will read from stdin for extraction or write to stdout for creation.

Seems like a redundant flag. Many utilities are perfectly fine reading from stdin if no [file] is specified, without any kind of -f flag.

It's redundant for extraction. For creation (-c) where you can list many files, it's just a choice some unix developer made to allow the destination file to be specified independent of order. I think there'd be some awkward edge cases otherwise.

Anyway, adding verbosity to discourage operating on static files and prefering being on a pipeline could be considered a feature.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.