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.


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.

  • 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

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.


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.