> ## Content Index
> Fetch the complete content index at: https://mfitzp.ghost.io/llms.txt
> Use this file to discover other available public pages before exploring further.

# Piping between shells
- URL: https://mfitzp.ghost.io/piping-between-shells/
- Published: 2011-11-28T00:00:00.000Z
- Updated: 2023-06-26T10:02:32.000Z
- Description: Create your own bash pipes to send program output between shells, processes and users.
- Author: Martin Fitzpatrick
- Tags: Tutorials, Linux, #Import 2024-03-14 08:20, #Import 2026-08-24 14:26

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.

💡

**You will need to set appropriate permissions on the pipe file to share data between users. Try `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.

```Bash
mkfifo ~/fifo_pipe
```

Open 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:

```Bash
tail -f ~/fifo_pipe
```

This 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:

```Bash
ls >> ~/fifo_pipe
```

Running 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`!