Table of Contents

Pipe

About

pipe are file descriptor used for pipe communication between process (used for inter-process communication)

pipe is the basic block of pipeline (stream) communication on the operating system.

Example

Named Pipe: Minimal Usage

mkfifo my_pipe
ls -l my_pipe
prw-r--r-- 1 root root 0 May 31 10:15 my_pipe

echo "Hello, World!" > my_pipe &
echo "Hello, World!" > my_pipe &
cat < my_pipe
Hello, World!
Hello, World!
[1]-  Done                    echo "Hello, World!" > my_pipe
[2]+  Done                    echo "Hello, World!" > my_pipe

Anonymous Pipe (Docker)

pipe:[inode_number] indicates an anonymous pipe (not named) identified by its inode number.

Such links are commonly seen in the /proc filesystem, providing insight into the file descriptors and IPC mechanisms used by processes.

Example listing file descriptor for the process 1 in a Docker container

ls -l /proc/1/fd
lrwx------ 1 root root 64 May 30 12:22 0 -> /dev/null
l-wx------ 1 root root 64 May 30 12:22 1 -> 'pipe:[2333507]'
l-wx------ 1 root root 64 May 30 12:22 2 -> 'pipe:[2333508]'
lr-x------ 1 root root 64 May 31 09:57 255 -> /usr/local/bin/entrypoint.sh

pipe:[2333507] indicates that file descriptor 1 (stdout) is connected via a symlink to an anonymous pipe with inode number 2333507.