参考博客:mknod_liangkaiming的博客-****博客
参考资料:man手册
可以通过man 1 mknod查看mknod命令的内容。
1、mknod 命令的作用是make block or character special files,即创建块设备或者字符设备文件。
2、mknod 命令的格式是:mknod [OPTION]... NAME TYPE [MAJOR MINOR]
(1)OPTION的可选值与含义
- -m, --mode=MODE set file permission bits to MODE, not a=rw - umask
- -Z, --context=CTX set the SELinux security context of NAME to CTX
- --help display this help and exit
- --version output version information and exit
(2)NAME表示创建的设备文件的名字。
(3)TYPE可选值及含义
- b,create a block (buffered) special file
- c、u,create a character (unbuffered) special file
- p,create a FIFO
(4)MAJOR MINO表示主设备号、次设备号。
Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X, it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal; otherwise, as decimal.