The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
  

mkfifo - Creating Named Pipes





The command mkfifo (make FIFOs) is used to create "named pipes". Named pipes are primarily used for inter-process communication. The syntax for creating a named pipe using mkfifo is: mkfifo PIPE_NAME .

One commonly used option for mkfifo is "-m", which sets the permissions for the "PIPE_NAME".

Example:
$ mkfifo -m 644 myfifo ← Create a named pipe named "myfifo" with permissions "rw- r-- r--"
$ mkfifo -m g-w,o-rw myfifo1 ←Create another named pipe named "myfifo1" with specific permissions
$ ls -l myfifo1 ←Verify the permissions
prw-r-----. 1 usr usr 0 Jun 24 06:48 myfifo1 ←The leading "p" indicates a named pipe
$ file myfifo1 ← Verify using the "file" command
myfifo1: fifo (named pipe)

For more applications and operational examples involving named pipes, please refer to the provided link.