mknod 中文man頁面
名字
mknod - 建立塊專用或字符專用文件
總覽
mknod [options] name {bc} major minor
mknod [options] name p
GNU 選項(xiàng)(縮寫):
[-m mode] [--help] [--version] [--]
描述
mknod 用指定名稱產(chǎn)生一個(gè)FIFO(命名管道),字符專用或塊專用文件。
文件系統(tǒng)中的一個(gè)專用文件存貯著三種信息(布朗型、整型、整型)。布朗型在字符文件與塊文件之間作出選擇,兩個(gè)整型是主、次設(shè)備號。
通常,一個(gè)專用文件并不在磁盤上占用空間,僅僅是為操作系統(tǒng)提供交流,而不是為數(shù)據(jù)存貯服務(wù)。一般地,專用文件會(huì)指向一個(gè)硬件設(shè)備(如:磁盤、磁帶、打印機(jī)、虛擬控制臺(tái))或者操作系統(tǒng)提供的服務(wù)(如:/dev/null, /dev/random)。
塊文件通常類似于磁盤設(shè)備(在數(shù)據(jù)可以被訪問的地方賦予一個(gè)塊號,意味著同時(shí)設(shè)定了一個(gè)塊緩存)。所有其他設(shè)備都是字符文件。(以前,兩種文件類型間是有差別的。比如:字符文件I/O沒有緩存,而塊文件則有。)
mknod命令就是用來產(chǎn)生這種類型文件的。
以下參數(shù)指定了所產(chǎn)生文件的類型:
- p
- FIFO型
- b
- 塊文件
- c
- 字符文件
GNU版本還允許使用u('unbufferd'非緩沖化),以保持與C語言的一致。
當(dāng)創(chuàng)建一個(gè)塊文件或字符文件時(shí),主、次設(shè)備號必須在文件類型參數(shù)后給出。(十進(jìn)制或八進(jìn)制以0開頭;GNU 版本還允許使用以0x開頭的十六進(jìn)制)缺省地,所產(chǎn)生的文件模式為0666('a+rw')。
選項(xiàng)
- -m mode, --mode=mode
- 為新建立的文件設(shè)定模式,就象應(yīng)用命令chmod一樣,以后仍然使用缺省模式建立新目錄。
GNU 標(biāo)準(zhǔn)選項(xiàng)
- --help
- 在標(biāo)準(zhǔn)輸出上顯示使用信息并順利退出。
- --version
- 在標(biāo)準(zhǔn)輸出上顯示版本信息并順利退出
- --
- 終端選項(xiàng)列表。
遵循
POSIX 認(rèn)為該命令不能移植而不支持這個(gè)命令,它推薦使用 mkfifo(1)來建立FIFO文件。SVID有一個(gè)命令/etc/mknod有以上語法,但沒有模式選項(xiàng)。
注意
在某些linux系統(tǒng)上(1.3.22或之后的版本) /usr/src/linux/Documentation/devices.tex文件包含了一個(gè)設(shè)備列表,包括設(shè)備名、類型及主、次設(shè)備號。本頁對mknod的描述可以在fileutils-4.0中找到;其他版本會(huì)略有差別。任何添加或糾錯(cuò)意見請寄aeb@cwi.nl,程序Bugs請告知: fileutils-bugs@gnu.ai.mit.edu
另見
chmod(1), mkfifo(1),mknod(2)
#p#
NAME
mknod - make block or character special files
SYNOPSIS
mknod [OPTION]... NAME TYPE [MAJOR MINOR]
DESCRIPTION
Create the special file NAME of the given TYPE.
Mandatory arguments to long options are mandatory for short options too.
- -Z, --context=CONTEXT
- set security context (quoted string)
- -m, --mode=MODE
- set permission mode (as in chmod), not a=rw - umask
- --help
- display this help and exit
- --version
- output version information and exit
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. TYPE may be:
- b
- create a block (buffered) special file
- c, u
- create a character (unbuffered) special file
- p
- create a FIFO
AUTHOR
Written by David MacKenzie.
REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.
COPYRIGHT
Copyright © 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO
The full documentation for mknod is maintained as a Texinfo manual. If the info and mknod programs are properly installed at your site, the command
- info coreutils mknod
should give you access to the complete manual.