I am following a guide to learn terminal commands and have encountered the use of hyphens to refer to stdin in the following command used to find all files named 'file-A' within the directory playground. I understand it's usage to refer to the files found by the find command which are of course piped to tar and set to be read as a file using the --files-from= option. I do not understand it's usage in defining the intermediary name of the archive before being renamed by the gzip command.

 find ./playground -name 'file-A' | tar -cf - --files-from=- | gzip playground.tgz

Would the value of stdin not be a list of paths defined in the stdin file? if so how can this be an acceptable name for the archive?


1 Answer 1


I can't find it in the tar manual. However - is often used by tools as a pseudo-filename referring to stdin or stdout. tar is using if for both. -f - saying output to stdout and --files-from=- saying get a list of file-names from stdin. The in and out are implied, these options expect an output and input respectively.

Also: gzip is not renaming. And there are no temporary files, data is passed via pipes.

  • Ah I see thank you so it does not create a filename with the value of Stdin but send a the archive to stdout. Very helpful, have a nice day
    – nrmad
    Dec 29, 2020 at 12:58

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.