A short introdution to name pipes as I see them.

In the Linux world name pipes are typically used to permit communications between 2 unrelated processes. Name pipes are also known as FIFOs (first in, first out), normally used to establish a one-way flow of data.(half-duplex). Name pipes have a path name of a file associated with them, this is how calling process will reference the name pipes.

Name pipes are file system persistent objects. What this means is that name pipes are always available till the time they are explicitly deleted from the file system as they are represented by as standard files on the file-system. As for standard pipes that we religiously use in our day to day Linux life also known as anonymous pipes are process persistent objects meaning that the name pipes are removed as soon as the processes no longer use them.

What does mkfifo do

mkfifo is used to create a FIFOs(name pipe). “mkfifo test-pipe”, now we have a name pipe called “test-pipe”.

“ls > test-pipe”, this pipes the output of the ls command into the name pipe “test-pipe”.

“cat name-pipe | while read line i; do rm -f $i; done” this will delete the files passed. At this point the “test-pipe” will be empty. “cat test-pipe” will come up blank.

I’ve added a screen-shots of the above in action on the next page. Check it out.

I’m not a Linux guru yet, so guys if my information not accurate or if there is a better way to improve my example please feel free to comment.

mkfifo