1

Is it possible to use mkfifo (named pipes) in Linux to copy files?

For example: I am extracting files from tar archive and I want them to be moved immediately to another location.

  • you can use tar -C to specify a location. unclear how you want fifo to come into play here. – frostschutz Apr 5 '19 at 10:31
3

You can't use mkfifo to copy or move files, no. mkfifo creates a named pipe. You can use a pipe to arrange for data to go to a different place, and occasionally a named pipe is the only way or is more convenient. You can find some solutions that use mkfifo on this site. But a pipe isn't usually useful if you only want data to end up in a different place: for that, redirection is enough.

If you want to extract files from a tar archive and put them in a different place than the path inside the archive, named pipes aren't going to help you at all. Instead, use the --transform option of GNU tar or the -s option of BSD tar or pax to rewrite the file paths during the extraction.

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.