I have a really weird issue where I'm getting an extra - insertion on tar:

# tar -zxvf mod_wsgi-3.3.tar.gz 
/bin/tar: unrecognized option '--zxvf'
Try `tar --help' or `tar --usage' for more information.

The same issue happens if I try to do --help

# tar --help
/bin/tar: unrecognized option `---help'
Try `tar --help' or `tar --usage' for more information.

But if I drop the first - both of the above examples work. Any ideas on how I can find and disable whatever is causing that?

  • 1
    What version of Ubuntu are you running? – Lekensteyn Apr 15 '11 at 15:09
  • Interesting. I always run tar without the dash : tar xvfz blah . – belacqua Apr 15 '11 at 15:39
  • @Kit, and what version of tar ? – belacqua Apr 15 '11 at 15:40
  • @Lekensteyn A really bare version of 10.04 as supplied with my VPS. I've had to install just about everything myself. @jgbelacqua - 1.22 – Kit Sunde Apr 15 '11 at 16:21
  • @jgbelacqua: me too, but that is only allowed as first argument, so if you need to supply a different extraction dir, you would do something like tar xf file.tar.gz -C /target. – Lekensteyn Apr 15 '11 at 16:24

I suspect there's an alias or function mangling your tar.

Post the output of alias | grep tar and set | grep -E "function tar|tar \(\)"

(I know I should leave a comment, but I don't have enough rep-point for commenting, yet)

Edit: Also, post the output of which tar please.

|improve this answer|||||
  • It actually makes sense as answer, but I could not reproduce it with an alias as in alias tar='tar -'. – Lekensteyn Apr 15 '11 at 15:11
  • 1
    @Lekensteyn Indeed. The space after the aliased tar possibly renders the additional dash ineffective. So I've edited my 'answer' to check out for a 'tar' script somewhere in the system. – pepoluan Apr 15 '11 at 15:15
  • 1
    AHA, which tar says my tar is in /usr/local/sbin/tar! I had worked around another issue where tar was failing on some permission bug and someone on ubuntuforums suggested adding a user defined tar, and then running dist-upgrade to solve it. However I had forgotten to remove it (twice!). ubuntuforums.org/showpost.php?p=10366526&postcount=4 – Kit Sunde Apr 15 '11 at 16:30
  • 1
    type -a tar will give all the information you were trying to collect with those commands. help type. – geirha Apr 15 '11 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.