I am in the directory where the file.tar.gz file is located. I want to ignore umask by using the -p (--preserve) option. But I am unable to untar it with -p flag. What may be the reason for it?

  • tar -xvfp file.tar.gz # does not work
  • tar -xvf file.tar.gz # when I remove p it works
$ ls *file.tar.gz

$ tar -xvfp file.tar.gz
tar: p: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

$ tar -xvf file.tar.gz

tar interprets the next argument after -f as the file name of the tar file.

Put the p before the f:

tar -xvpf file.tar.gz
| improve this answer | |

Try separating -p from the -f command, as

tar -p -xvf file.tar.gz
| improve this answer | |

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.