Piping between shells
Create your own bash pipes to send program output between shells, processes and users.
You may already be familiar with the | command used to send the output of one command into another, e.g. cat /var/log/messages | less. In this short tutorial we'll create user-defined pipes to carry output between shells or users.
chmod 644 fifo_pipe.First create the pipe through which you'll send the data using the mkfifo command. This refers to the type of buffer you are creating: 'first in first out' i.e. a pipe.
mkfifo ~/fifo_pipeOpen up a new shell - either open a new terminal window or start a new session. Keep your previous one running so you can send the data from there. In the new window enter:
tail -f ~/fifo_pipeThis runs tail (which outputs the end of the buffer) with the -f option to 'follow' output - that is continue outputting what it finds in the fifo pipe.
Return to the original shell session and now enter:
ls >> ~/fifo_pipeRunning this will perform a directory listing of the current directory, outputting the result into the fifo_pipe we previously created. Now switch back to your second session and see the output of ls!