Code: Select all
cat /var/log/somelog.log |less
Code: Select all
mkfifo berserk_pipe
To put this file in receiver mode you can simply do a
Code: Select all
cat berserk_pipe
Now 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_pipe
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:
Code: Select all
tail -f berserk_pipe
As 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_pipe
the output will be something like this:
Code: Select all
prw-r--r-- 1 berserk berserk 0 juni 21 16:15 berserk_pipe
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...