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.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175

1 Answers1

4

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.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175