Linux mkfifo Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux mkfifo Guide
Complete beginner-friendly guide to mkfifo on Linux, covering Arch Linux, CachyOS, and other distributions including named pipe creation, FIFO creation, and inter-process communication.
Table of Contents
Understanding mkfifo
What is mkfifo?
mkfifo creates named pipes (FIFOs).
Uses:
- Named pipes: Create FIFO special files
- IPC: Inter-process communication
- Process communication: Communication between processes
- Data streaming: Stream data between processes
Why it matters:
- IPC: Enable process communication
- Data flow: Stream data between processes
- Synchronization: Synchronize processes
mkfifo Basics
Create FIFO
Basic usage:
# Create named pipe
mkfifo mypipe
# Creates FIFO named "mypipe"
With Permissions
Set permissions:
# With permissions
mkfifo -m 666 mypipe
# -m = mode (666 permissions)
Creating FIFOs
Simple FIFO
Basic FIFO:
# Create FIFO
mkfifo mypipe
# Creates named pipe
Multiple FIFOs
Multiple pipes:
# Multiple FIFOs
mkfifo pipe1 pipe2 pipe3
# Creates multiple named pipes
Using FIFOs
Write to FIFO
Send data:
# Write to FIFO
echo "Hello" > mypipe
# Sends data to pipe
Read from FIFO
Receive data:
# Read from FIFO
cat < mypipe
# Receives data from pipe
Troubleshooting
mkfifo Not Found
Check installation:
# mkfifo is part of coreutils
# Usually pre-installed
# Check mkfifo
which mkfifo
Summary
This guide covered mkfifo usage, named pipe creation, and inter-process communication for Arch Linux, CachyOS, and other distributions.
Next Steps
- mknod Guide - Device node creation
- Process Management - Process management
- Bash Scripting Guide - Scripting basics
- mkfifo Documentation:
man mkfifo
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.