Named pipes - FIFO pipes.
Posted: 21 Jun 2014, 15:34
We have that regular pipes typically It will show you the log per page. The named pipes or FIFO (First in First Out) pipes are a container ready to receive your instructions and is a file so you have to create it:
To put this file in receiver mode you can simply do a
Now this terminal will be "frozen" waiting for messages.
Open another terminal next to the frozen one and type:
The message will turn up in the other receiving terminal and it will go back to the normal prompt

To make the receiving terminal remain in that "listening mode" you can start it with:

As you can see the left terminal will wait for any command or message. You can send regular commands too:

It can be useful when exchanging data between different users etc.
You can also use this in combination with SSH
Remember berserk_pipe is just a file and you can have a look at it with:
the output will be something like this:
Note the p in front it indicates that it is a pipe.
If you have started the pipe with tail -f you need to stop it with CTRL+C
The pipe file can be removed with a regular rm.
So what can this be used for? Use your imagination
I will come up with a practical example later...
Code: Select all
cat /var/log/somelog.log |lessCode: Select all
mkfifo berserk_pipeTo put this file in receiver mode you can simply do a
Code: Select all
cat berserk_pipeNow this terminal will be "frozen" waiting for messages.
Open another terminal next to the frozen one and type:
Code: Select all
echo "Hi Hola Hallo!!" >>berserk_pipeThe message will turn up in the other receiving terminal and it will go back to the normal prompt
To make the receiving terminal remain in that "listening mode" you can start it with:
Code: Select all
tail -f berserk_pipeAs you can see the left terminal will wait for any command or message. You can send regular commands too:
Code: Select all
ls >> berserk_pipe
It can be useful when exchanging data between different users etc.
You can also use this in combination with SSH
Code: Select all
ssh berserk@10.0.0.12 "echo hallo >> berserk_pipe"Remember berserk_pipe is just a file and you can have a look at it with:
Code: Select all
ls -l berserk_pipethe output will be something like this:
Code: Select all
prw-r--r-- 1 berserk berserk 0 juni 21 16:15 berserk_pipeNote the p in front it indicates that it is a pipe.
If you have started the pipe with tail -f you need to stop it with CTRL+C
The pipe file can be removed with a regular rm.
So what can this be used for? Use your imagination