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.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
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.