Skip to content


Please, stop abusing “tar” with “zxvf”


I can’t stand it anymore, I need to write something about the abuse of tar(1) I constantly see around the web. It hurts my eyes, it bothers me because of its abuse of the UNIX philosophy, and most importantly, it teaches bad practices to new (and older) users of GNU tools.

Most often I notice this usage of tar in instructions given at download pages of open-source software, where a user needs to download a bundle of code and needs instructions how to extract it, build it and install it.

But, before starting, I would also like to mention that it is unnecessary to run tar with this syntax:

$ tar -zxvf file.tar.gz

The program needs a command as its first argument (the manual calls it “function”) and it should be one of the letters “Acdrtux”. This command is not an option, but an obligatory command, without of it tar can’t operate at all. So, we can easily drop the “-” in the syntax.

$ tar zxvf file.tar.gz

But the most serious abuse of tar and UNIX philosophy is the usage of the “-v” (verbose) option. More specifically, it contracts the “Rule of Silence”:

Rule of Silence: When a program has nothing surprising to say, it should say nothing.

Indeed, tar is very spartan and won’t bother us at all if everything went fine. And why should I watch a huge list of files passing in front of my screen, only for my eyes to get tired of so much useless information?

I have to ask to all those developers or users who suggest the usage of the “-v” flag, how many times are we really interested in seeing a (mostly huge) list of files being copied in our filesystem? As an irony, I have noticed quite few times in the past the contradictious syntax:

$ tar zxvf file.tar.gz > /dev/null

Excuse me?! You don’t want any output in your terminal, but you force us to type so many keys in ours? Please, don’t suggest such usage.

As a last word, here is also a bonus tip: Latest versions of GNU tar, the ones most people already use in their machines, can easily figure out the underlying compression scheme used in the archive file. So there is no need for the “z” command either!

$ tar xf file.tar.gz

So here we are, we managed to save a whole 3 keystrokes out of 10 and a lot of noise in our terminal!


From → General, Linux, Shell

Leave a Comment

What do you think?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: