Unable to run tar command - invalid option -- '▒'

18,696

Solution 1

Thanks to Paul R I have an answer. No idea how to mark his comment as the answer though so here it is:

Some older versions of tar don't like the - at the start of the commands - try tar cvpfz .... – Paul R 5 mins ago

Solution 2

Are you copy and pasting the command, instead of hand-typing it in terminal?

In my case, I was getting:

tar: invalid option -- '�'

I was pasting into terminal, the command from a raw text file, which I had copied from a tutorial:

tar –xvzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz

I hand-typed the entire command:

tar -xvzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz

and it worked. I suspect it was something like an extra space character or a - or similar which was not working.

Share:
18,696
Angus
Author by

Angus

Updated on July 22, 2022

Comments

  • Angus
    Angus almost 2 years

    I've run into a problem while running a tar script. I am getting an invalid option, as shown in the screenshots, that is stopping the script running. I don't get why however as the command worked outwith the script. Can anyone help me?

    The script:

    The script

    The error:

    The error

    • Paul R
      Paul R about 8 years
      Some older versions of tar don't like the - at the start of the commands - try tar cvpfz ....
    • Angus
      Angus about 8 years
      Thanks a lot. That resolved the issue.
  • Paul R
    Paul R about 8 years
    No problem - glad it helped - have some rep... ;-)