Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [fifo]

Questions about FIFO - first-in first-out special file, also known named pipe

3
votes
1answer
54 views

Make GNU Parallel not delay before executing arguments from STDIN

GNU Parallel, without any command line options, allows you to easily parallelize a command whose last argument is determined by a line of STDIN: $ seq 3 | parallel echo 2 1 3 Note that parallel does ...
2
votes
1answer
63 views

concurrent processing in bash using process expansion, and redirection

Apart from possible races that have to be controlled by using proper synchronisation, it's possible in bash to feed a data source concurrently into multiple pipelines and collect all their outputs ...
1
vote
2answers
32 views

Two named PIPEs (PIPE_in/PIPE_out) connected with `tail -f` | String sent to PIPE_in doesn't reach PIPE_out

1.Create named PIPEs, pipe_in and pipe_out by running: $ mkfifo pipe_in $ mkfifo pipe_out 2.Connect pipe_in to pipe_out: TERM0: $ tail -f pipe_in > pipe_out 3.Send string hello world! to ...
6
votes
3answers
182 views

What characterizes a file in Linux/Unix?

What characterizes a file in Linux/Unix? A file can have many types: regular file, directory, symlink, device file, socket, pipe, fifo, and more that I miss. For example, a symlink: $ sudo file /...
5
votes
2answers
263 views

grep --exclude option doesn't always skip named pipes

I have a directory that contains, among other files, 3 named pipes: FIFO, FIFO1, and FIFO11. If I try something like grep mypattern * in this directory, grep hangs forever on the named pipes, so I ...
2
votes
0answers
86 views

How do I make systemd sockets close when service is stopped?

I'm currently trying to make a systemd service with two Fifo sockets. These sockets map to stdout and stdin of the application. I'm currently using the following configuration files. foo.service [...
2
votes
2answers
56 views

Bash: join pipes without deadlock

I want to list a bunch of filenames via find, pipe them through a utility (let's call this util) which outputs a new name for each input name, and then rename each file from the old name to the new. ...
0
votes
1answer
53 views

How to Pipe Segment of Heredoc Output to Local File

I am issuing a command to a remote device in order to run a tcpdump on one of it's interfaces, but capture the output to a local .pcap file on my Ubuntu VM. The command that I'm issuing is as follows: ...
0
votes
1answer
81 views

How to Pass Multiple Commands to Remote Device via SSHPass [duplicate]

I'm trying to setup a method in which I can run remote tcpdumps on some of my devices, and save the file to my local machine for analysis (I don't want to save the file on the remote device and then ...
3
votes
1answer
177 views

Using exec 3> to keep a named pipe open

The process reading from a named pipe will normally terminate when the process writing to the pipe finishes writing (sends an EOF). In certain situations you may have different processes writing ...
2
votes
0answers
36 views

How to trigger a command after named pipe closes?

How can I execute some command after the named pipe has been readout in other end. I was trying to use trap. But nothing happens. My script is something like below. #!/bin/sh cleanup() { echo "...
0
votes
2answers
85 views

How to let process continue running even after disconnecting ssh?

I have a Linux based router that I’m trying to “control” with a home automation controller. On my automation controller I’m able to utilize a ‘two way strings’ driver to send a string to the Linux ...
0
votes
0answers
71 views

Multiple fifos over SSH

Shell script allow multiple file descriptors (up to 9 for POSIX compliance, but even more for bash): $ install -m 755 /dev/stdin /tmp/test <<\EOF #!/bin/sh echo hi1 >&1 echo hi2 >&...
0
votes
1answer
193 views

How can I stop ffmpeg from quitting when it reaches the end of a named pipe?

I'm using a program which continuously writes MPEG-TS video data to a file while it's running. I'm expecting it to run continuously for many days. I want to use ffmpeg to transcode this video data ...
0
votes
1answer
53 views

How to read screen's named pipe?

For curiosity, I wanted to read a GNU screen session's named pipe. $ screen -ls There is a screen on: 59750.hello (Detached) 1 Socket in /var/run/screen/S-gergely. And indeed there is a ...
2
votes
0answers
55 views

Knowing when bash is done running a command through a FIFO pipe

I'm trying to link a web-based terminal with bash. My current attempt to do so is spawning a shell pointing a FIFO pipe to its input, like this: Terminal 1 $ mkfifo pipe $ bash <> pipe file1 ...
0
votes
1answer
50 views

Pipe to fifo from script

I want to send commands from a script to twinkle (the VOIP software). I thought I could do this with a named pipe so I have created one mkfifo phonecmd If I start twinkle and pipe tail from the ...
2
votes
0answers
75 views

How can I make named pipes atomic or is there an alternative? [duplicate]

Reopen voters: flock() doesn't work on named pipes, this is not a dupe. I was trying to do the following with named pipes: mkfifo example.txt ( printf "456"; printf "abc"; printf "\n"; ) > ...
4
votes
1answer
235 views

How can I know whether writing to a named pipe would block?

I want to write to a named pipe only if it already has a reader. Currently, I'm using timeout to detect whether the attempt to write to the pipe blocked, like so: #! /usr/bin/env bash rm -f pipe ...
0
votes
0answers
387 views

Cleaning/flushing of named pipe

I create FIFO to communicate between unrelated processes. In my project there is no way to break infinite loop in which the program runs. So, I can't unlink the FIFO. I thought that I could remove ...
1
vote
0answers
29 views

Retaining data in a named pipe after an incomplete read access

Prerequisites: $ mkfifo pipe1 If several lines are put into pipe1 $ (echo line 1; echo line 2) > pipe1 all the lines can be read in another terminal by $ cat pipe1 line 1 line 2 So far all ...
0
votes
1answer
20 views

Is it possible to remount a filesystem read-only, if it has open fifos?

If a file is still open for writing on the root file system, for example, the filesystem cannot be remounted read-only for a clean shutdown. At least this is true for regular files. But what about ...
3
votes
2answers
946 views

Writing on a FIFO with multiple processes

I need to make a named pipe with mkfifo. For instance: mkfifo mypipe I'm going to have a systemd service (a simple shell script) that read from the pipe and I will write on the same pipe calling ...
0
votes
1answer
218 views

Split output and rejoin again with named pipes on linux

My question is related to https://serverfault.com/questions/171095/how-do-i-join-two-named-pipes-into-single-input-stream-in-linux but with a slightly more convoluted setup. I have three programs, ...
10
votes
3answers
2k views

Named pipes, file descriptors and EOF

Two windows, same user, with bash prompts. In window-1 type: $ mkfifo f; exec <f So bash is now attempting to read from file descriptor 0, which is mapped to named pipe f. In window-2 type: $ ...
0
votes
1answer
202 views

using fifo for daemons

While studying from Richard Stevens' book Unix network programming, I came across the following lines that speak about using FIFO between a client and a server. Client processes are started and ...
2
votes
1answer
230 views

Why stdout won't flush when redirecting input from a fifo?

I have a program that displays a prompt message and waits for the user to input some text. $ program Input a line of text: <aaaa> Some more output. $ Now, I also want to be able to provide ...
0
votes
1answer
414 views

bash: Reading a full record from a fifo

I wish to send a command to process A, from process B, via a FIFO. The command will be a word or a sentence, but wholly contained on a "\n" terminated line - but could, in general, be a multi-line ...
0
votes
1answer
114 views

Linux AIO / io_submit / io_getevents / on fifo (named pipes)

I have to write a lot of data to a pipe. Can I use the Linux calls io_submit/io_getevents for writing to Named Pipes or it is defined only for regular files. I tried finding any document which ...
0
votes
1answer
43 views

Can FIFO or other thing not block on writer's access, and instead just drop data?

FIFO is problematic in use because both reader and writer have to open it – if one of them is being late, the other one is blocked inside the operating system. I have to implement a publishing ...
0
votes
0answers
33 views

SIGINT received by pipeline consumer is ignored by default?

I have a pipeline like so: foo | bar if I issue a SIGINT in terminal (in the form of ctrl+c), the second process (bar) will receive the SIGINT, but it just seems to ignore it, almost certainly ...
1
vote
1answer
419 views

Creating a tarball from named pipes using tar or python's tarfile module

I didn't realize this would be so difficult. I'm just using tar. I have two pieces of data, one's a large payload of pcap data, the other is some additional metadata in the form of a python pickled ...
0
votes
1answer
39 views

Programmatically closing pipeline / exiting [closed]

I have a pipeline like so: tail -n0 -f "${my_input}" | ql_receiver_lock_holder | while read line; do echo "$line" >> "${my_output}"; # xxx: how can I programmatically close the ...
0
votes
2answers
46 views

Avoid overwriting existing named pipe

I have this command: ql_receiver_lock_holder > "${my_named_pipe}" will it overwrite the named pipe if it already exists? Is the best way to avoid overwriting it to simply use this: ...
4
votes
1answer
1k views

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: ...
1
vote
1answer
309 views

Read and write to same netcat tcp connection

I have this pipeline: ( tail -f ${named_pipe} | nc localhost ${port} | ql_conditional_release &> "$HOME/debug.log" & disown; ) &> /dev/null so I am reading from the netcat ...
1
vote
1answer
323 views

How does a temporary file differs from a pipe? [duplicate]

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 ...
12
votes
2answers
3k views

How does a FIFO (named pipe) differs from a regular pipe (unnamed pipe)? [duplicate]

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 ...
0
votes
1answer
252 views

Process substitution vs FIFO (created by `makefifo`)

As far as I know, process substitution in bash and FIFO (created by mkfifo) are both named pipes. They both seem viable solutions for communication between processes. I was wondering how to decide ...
0
votes
1answer
48 views

When does a command in a process substitution or FIFO start and finish running?

When does a command in a process substitution in bash start and finish running? E.g. when does command1 in command2 >(command1) start and finish running respectively? when does command3 in ...
1
vote
1answer
774 views

What is the purpose of using a FIFO vs a temporary file or a pipe?

From APUE FIFOs can be used to duplicate an output stream in a series of shell commands. This prevents writing the data to an intermediate disk file (similar to using pipes to avoid intermediate ...
2
votes
2answers
3k views

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 <hangs> shell 2$ cat fifo foo shell ...
1
vote
1answer
484 views

How to make SOCAT send each character from STDIO?

I have the following scenario: I have a Windows in a VM, which has an exposed serial port to a host pipe (named-pipe / fifo). The host pipe is at /tmp/win-serial-com3. On my host OS, I'm using ...
1
vote
2answers
268 views

Capture data going through named pipe

Is there a practical and easy way to capture data going through a named pipe? I've tried wireshark, but it only accepts a specific data format. I've also tried cat, but I get mixed results. Thank you
0
votes
1answer
221 views

How can FFmpeg record from FIFO without an “invalid data” error?

I have an internet calling infrastructure that can result in audio being played through speakers in the following way: aplay -r 48000 -c 1 -f S16_LE - < contact/call_out Here, call_out is a FIFO ...
0
votes
1answer
38 views

What methods exist for capturing stdout into a buffer that is automatically cleared on read?

I want to store the stdout from a process into a buffer and have the buffer emptied once read, FIFO style. I know that I can pipe the stdout, but the pipe/file will keep growing and contain data that ...
0
votes
2answers
2k views

How to send commands to fbi over SSH?

I'm using fbi to display some images. fbi has some keyboard controls, like +, -, Page Up, Page Down, etc. to control the images. Instead of using keyboard, I want to send these control commands over ...
3
votes
1answer
6k views

How to save an output of airodump-ng to a file?

I've tried to get a file from airodump-ng via redirecting a output stream via: airodump-ng mon0 2>&1 | tee file.txt but this appends to a file rather than rewrites it. So after that I've ...
1
vote
1answer
50 views

Pass handle to stdin down pipeline

Say I have node foo.js | node bar.js is there a way to pass a handle on foo's stdin to bar? I have a rare case where I'd like to communicate backwards in the pipeline. At the least I know that I ...
3
votes
1answer
54 views

Store the most recent N MBs of a stream?

I currently use wget or curl to download a continuous AAC-stream. I would like to limit what's stored on disk to the most recent N MB. In other words, some kind of size limited FIFO-buffer (I guess?). ...