212

I had a look at the options, but nothing seemed obvious as a manner in which to turn off the output when uncompressing a file. The below is the code I am currently using... I just need the option to switch off the output.

tar -zxvf tmp.tar.gz -C ~/tmp1
Leo
  • 100
  • 10
h.l.m
  • 13,015
  • 22
  • 82
  • 169
  • 3
    apologies i blindly copied the options from before...and didnt see that i was putting in `v` – h.l.m Nov 12 '12 at 11:00
  • 16
    Ha! How many of us must be passing "v" without even thinking about it. And then, after we tell tar to output a lot, we wonder why it's outputting a lot :P. – Alexander Bird Nov 29 '16 at 20:31

1 Answers1

383

Just drop the option v.

-v is for verbose. If you don't use it then it won't display:

tar -zxf tmp.tar.gz -C ~/tmp1
P.P
  • 117,907
  • 20
  • 175
  • 238
  • 4
    And will it show errors even in non-verbose mode? – Phil Filippak Feb 13 '16 at 06:47
  • 15
    @PhilFilippak Yes. tar sends the errors to stderr. So you'll see any error messages. – P.P Feb 17 '16 at 09:22
  • 9
    It'll also send out the extracted file's name. I couldn't turn off it either. – Clock ZHONG Mar 11 '17 at 07:01
  • 1
    Just in case you want to avoid output sent to stderr and stdout, you can add `>/dev/null 2>&1`to the command shown in this answer. – André Gasser Dec 12 '17 at 20:02
  • 7
    @AndréGasser Indeed. If you are using bash then you can shorten it with: `&>/dev/null` (or `>&/dev/null`). e.g. `$ cmd &>/dev/null` (or `$ cmd &>file` to redirect both stderr and stdout to a file). – P.P Dec 12 '17 at 20:09
  • 1
    @ClockZHONG That didn't happen when I tried it – Leo Jul 09 '23 at 08:28