Almost everything in Linux can be considered a file, but the main difference between a regular file and a named pipe is that a named pipe is a special instance of a file that has no contents on the filesystem.
Here is quote from
A FIFO special file (a named pipe) is similar to a pipe, except that it is accessed as part of the filesystem. It can be opened by multiple processes for reading or writing. When processes are exchanging data via the FIFO, the kernel passes all data internally without writing it to the filesystem. Thus, the FIFO special file has no contents on the filesystem; the filesystem entry merely serves as a reference point so that processes can access the pipe using a name in the filesystem.
The kernel maintains exactly one pipe object for each FIFO special file that is opened by at least one process. The FIFO must be opened on both ends (reading and writing) before data can be passed. Normally, opening the FIFO blocks until the other end is opened also.
So actually a named pipe does nothing until some process reads and writes to it. It does not take any space on the hard disk (except a little bit of meta information), it does not use the CPU.
You can check it by doing this:
Create a named pipe
$ mkfifo /tmp/testpipe
Go to some directory, for example
/home/user/Documents, and gzip everything inside it, using named pipe.
$ cd /home/user/Documents
$ tar cvf - . | gzip > /tmp/testpipe &
Here you should see the PID of the gzip process. In our example it was 28584.
Now check what this PID is doing
$ ps u -P 28584
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
c0rp 28584 0.0 0.0 29276 7800 pts/8 S 00:08 0:00 bash
You will see that it is using no resources. 0% CPU usage, 0% memory usage.
Verify hunch regarding file space usage
$ du -h /tmp/testpipe
0, nothing. The testpipe could be used again if needed.
Don't forget to kill gzip, using
kill -15 28584. And remove our named pipe using
You can redirect almost everything using named pipe. As example you can see this one line proxy.
Also here is one more nice explanation of named pipe usage. You can configure two processes on one server to communicate using a named pipe instead of TCP/IP stack. It is much faster, and does not load network resources. For example your Web Server can communicate with the database directly using a named pipe, instead of using
localhost address or listening to some port.