Angus
Angus

Reputation: 517

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

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

Upvotes: 17

Views: 33930

Answers (3)

Tropicalrambler
Tropicalrambler

Reputation: 707

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.

Upvotes: 21

Yeop
Yeop

Reputation: 11

In my case, i tried chmod 777 'FILE_NAME' for unlock the file.

Then installing, it works well!

Upvotes: 0

Angus
Angus

Reputation: 517

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

Upvotes: 30

Related Questions