国际访客建议访问 Primers 编程伙伴 国际版站点 > Bash 教程 > mkfifo 以获得更好的体验。

# Bash 的 mkfifo 命令

mkfifo [OPTION]... NAME...

!subtitle:功能

创建命名管道文件。

!subtitle:类型

可执行文件(/usr/bin/mkfifo),属于 coreutils

!subtitle:参数

  • OPTION 选项:

    • -m, --mode=MODE - 设置文件的访问权限;默认为 a=rw - umask

    • -Z - 将 SELinux 安全上下文设为默认类型

    • --context[=CTX] - 将 SELinux 安全上下文设为 CTX

    • --help - 显示帮助

    • --version - 显示版本

  • NAME - 文件名

# 示例

$ mkfifo my_fifo
$ ls -l my_fifo
prw-rw-r-- 1 primers primers 0 Nov 18 13:08 my_fifo

# 相关命令

命令 说明
touch 创建普通文件或刷新访问时间
mkdir 创建目录
mknod 创建设备文件
mktemp 创建临时文件或目录
link 创建硬链接
ln 创建硬链接或符号链接

# 推荐阅读

# 手册

MKFIFO(1)                        User Commands                       MKFIFO(1)

NAME
       mkfifo - make FIFOs (named pipes)

SYNOPSIS
       mkfifo [OPTION]... NAME...

DESCRIPTION
       Create named pipes (FIFOs) with the given NAMEs.

       Mandatory  arguments  to  long  options are mandatory for short options
       too.

       -m, --mode=MODE
              set file permission bits to MODE, not a=rw - umask

       -Z     set the SELinux security context to default type

       --context[=CTX]
              like -Z, or if CTX is specified then set the  SELinux  or  SMACK
              security context to CTX

       --help display this help and exit

       --version
              output version information and exit

AUTHOR
       Written by David MacKenzie.

REPORTING BUGS
       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
       Report any translation bugs to <https://translationproject.org/team/>

COPYRIGHT
       Copyright  ©  2023  Free Software Foundation, Inc.  License GPLv3+: GNU
       GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
       This is free software: you are free  to  change  and  redistribute  it.
       There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       mkfifo(3)

       Full documentation <https://www.gnu.org/software/coreutils/mkfifo>
       or available locally via: info '(coreutils) mkfifo invocation'

GNU coreutils 9.4                 April 2024                         MKFIFO(1)
本文 更新于: 2025-11-27 09:38:15 创建于: 2025-11-27 09:38:15