I'm trying to run a tar command and I keep getting this odd error.

The command:

  tar ./files.tar -C $HOME

And I get this in return:

 Error: tar: invalid option -- '.'

My files.tar folder is located correctly near my script and contains some directories.

Any ideas?

1 Answer 1


Add the options before the file name and so:

tar -xf files.tar -C $HOME
  • This just returns another error: tar: "C: Cannot open: No such file or directory" Oct 16, 2017 at 11:55
  • Are you trying to extract the tar file files.tar? Oct 16, 2017 at 11:56
  • 2
    The order of x and f must match the order of the arguments they are referring to. So tar xfC files.tar $HOME. Oct 16, 2017 at 11:57
  • Yes I am. But extract them in the home directory. Oct 16, 2017 at 11:57
  • @JohanMyréen That worked! Oct 16, 2017 at 11:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .