When one sends data (say stdout
) to a temporary file, it is likely that something would be done with that data (the temporary file will be used as stdin
for some process), then the temporary file will be deleted.
A pipe is a variant of special files, that can chain together commands; passing output from one program, as the input of another.
Generally, a regular pipe would be destroyed right after the process, but a named pipe (commonly named, and not necessarily 100% accurate, "FIFO"), will keep alive after the process ended, until a certain point.
My question
A temporary file is likely to be deleted after usage and a named pipe isn't, but what is the difference between a temporary file and a pipe in general, or at least, an anonymous pipe?
Update
I was wrong to think that a "temporary file" a special file, it isn't; It is a regular file that just being used differently; I would say that a pipe differs in the sense that it is defined as a special file, and has a single narrow purpose (chaining), while a temporary file might have other usages besides chaining, but, there might be a more "total" way to describe the difference.