Questions about FIFO - first-in first-out special file, also known named pipe
Questions tagged [fifo]
245 questions
54
votes
5 answers
Are FIFO, pipe & Unix domain socket the same thing in Linux kernel?
I heard that FIFOs are named pipes. And they have exactly the same semantics. On the other hand, I think Unix domain socket is quite similar to pipe (although I've never made use of it). So I wonder if they all refer to the same implementation in…
Justin
- 703
- 1
- 5
- 8
25
votes
2 answers
Are the named pipe created by `mknod` and the FIFO created by `mkfifo` equivalent?
I've used the mkfifo command to create named FIFOs, where one process writes to the file, and another process reads from the file.
Now, I know the mknod command is able to create named pipes. Are these named pipes equivalent to the FIFOs…
Shuzheng
- 4,023
- 1
- 31
- 71
24
votes
3 answers
Prevent automatic EOFs to a named pipe, and send an EOF when I want it
I have a program that exits automatically upon reading an EOF in a given stream ( in the following case, stdin ).
Now I want to make a shell script, which creates a named pipe and connect the program's stdin to it. Then the script writes to the pipe…
iBug
- 3,428
- 1
- 24
- 57
21
votes
1 answer
Why is a named pipe as slow as writing to a file?
I'm trying to understand how named pipes work so that I can streamline my one-way interprocess communication. I expect some overhead due to copying data into a circular buffer, which I would have thought is stored in RAM, and so I expected the pipe…
Jim Pivarski
- 333
- 2
- 7
21
votes
3 answers
continuous reading from named pipe (cat or tail -f)
I have configured rsyslog to log certain log events to /dev/xconsole:
*.*;cron.!=info;mail.!=info |/dev/xconsole
/dev/xconsole is a named pipe (fifo). If I want to see what is being logged, I can do cat /dev/xconsole. I am surprised to see,…
Martin Vegter
- 69
- 66
- 195
- 326
16
votes
3 answers
A virtual file containing the concatenation of other files
Is there a way of creating a filesystem object akin to this:
mknod files p
cat file1 file2 ... fileN > files
but such that it can be seeked in, as if it were a regular file?
Witiko
- 781
- 1
- 7
- 16
16
votes
1 answer
How to get an average pipe flow speed
If myfile is increasing over time, I can get the number of line per second using
tail -f | pv -lr > /dev/null
It gives instantaneous speed, not average.
How can I get the average speed (i.e the integral of the speed function v(t) over the…
user123456
- 4,758
- 11
- 52
- 78
15
votes
1 answer
How do I use inotify or named pipes over SSHFS?
Thanks sshfs magic, I can mount my home dir from a remote server with
sshfs user@server:/home/user ~/remote
Optimistically, I thought I'd set a local inotify-hook on ~/remote/logFile (in the sshfs mount) so a local program can react to remote log…
Anko - inactive in protest
- 4,506
- 2
- 29
- 57
14
votes
2 answers
How does a FIFO (named pipe) differs from a regular pipe (unnamed pipe)?
How does a FIFO (named pipe) differs from a regular pipe (|)? As I understand from Wikipedia, unlike a regular pipe, a FIFO pipe "keeps living" after the process has ended and can be deleted sometime afterwards.
But if f the process is based on a…
Arcticooling
- 1
- 12
- 44
- 103
14
votes
1 answer
“Leaky” pipes in linux
Let's assume you have a pipeline like the following:
$ a | b
If b stops processing stdin, after a while the pipe fills up, and writes, from a to its stdout, will block (until either b starts processing again or it dies).
If I wanted to avoid this, I…
CAFxX
- 231
- 1
- 12
14
votes
2 answers
Can you scp, sftp, or rsync, a pipe?
I want to tar and send a ~700GiB directory to a remote drive I don't control. I don't have the HDD space locally to create the tarball and then copy that over. The remote is also protected by rssh - you cannot ssh into the server and run arbitrary…
SaburoutaMishima
- 141
- 1
- 1
- 5
14
votes
9 answers
Filter or pipe certain sections of a file
I have an input file with some sections the are demarcated with start and end tags, for example:
line A
line B
@@inline-code-start
line X
line Y
line Z
@@inline-code-end
line C
line D
I want to apply a transformation to this file such that lines…
James Scriven
- 434
- 3
- 10
13
votes
2 answers
Under what conditions exactly does SIGPIPE happen?
Say we have a named pipe called fifo, and we're reading and writing to it from two different shells. Consider these two examples:
shell 1$ echo foo > fifo
shell 2$ cat fifo
foo
shell 1$ echo bar > fifo
shell 1$ cat > fifo
…
Naïm Favier
- 232
- 1
- 2
- 8
12
votes
3 answers
Named pipes, file descriptors and EOF
Two windows, same user, with bash prompts. In window-1 type:
$ mkfifo f; exec f
Now window-1 prints an ls and then the…
Fixee
- 1,891
- 3
- 17
- 24
12
votes
2 answers
Change buffer size of named pipe
I hear that for named pipes, writes that are smaller than about 512bytes are atomic (the writes won't interleave).
Is there a way to increase that amount for a specific named pipe?
something like:
mkfifo mynamedpipe --buf=2500
Supposedly this is…
Alexander Mills
- 9,330
- 19
- 95
- 180