1

This question already has an answer here:

When I specify root-folders in my tar command-line I deliberately prefix with "/" to tell tar it is root-folders and not sub-folders of current folder.

E.g.

tar --create --file="/tmp/test.tar" "/tmp/Folder 1/"
tar: Removing leading `/' from member names

Why is the leading "/" removed?

In regards to the -f / --file= option:
If you want to output to stdout you use -f - but it seems you cannot use --file= -.
I thought -f and --file were aliases to each other?

Beside I cannot find the -f - option in the manual (man tar)...shouldn't it be there? or have I just overlooked it.

marked as duplicate by harish.venkat, Jesse_b, G-Man, Jeff Schaller, LinuxSecurityFreak May 3 '18 at 6:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    @BMWW If you ask two questions in one, it can happen it will get closed as duplicate, altough only one of the questions has been answered before. – Philippos May 2 '18 at 15:42
2

Tar writes to stdout or reads from stdin by default, so there is no need for the dash character to mean stdout/stdin. Just leave out the -f parameter. You got a syntax error for --file= - because of the space between = and -. Long options with -- are written --param=value without spaces around the equals sign.

1

Try to avoid using full path when specifying the directory path, use relative path, it will be easier when restoring.

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