MKNOD(1)
π MKNOD π
okay bestie, pull up a chair πͺ because we're talking about mknod β the General Commands Manual girlie whose whole entire job is creating special files. Yes, special files. She's not like other commands. π
β¨ NAME β¨
mknod β Create the special file NAME of the given TYPE.
πΈ SYNOPSIS πΈ
mknod [OPTION]... NAME TYPE [MAJOR MINOR]
that's it. that's the whole vibe. short, sweet, iconic. π
π¦ DESCRIPTION π¦
Create the special file NAME of the given TYPE.
like... that's literally what she does. you hand her a name and a type and she manifests a special file into existence. no cap. β¨
π OPTIONS π
-m,--mode <MODE>β sets the file permission bits to MODE instead of usinga=rw - umask. like, you get to pick, bestie π«Ά-Zβ sets the SELinux security context of each created directory to the default type. security! we love her π--context[=<CTX>]β does the same thing as-Z, OR if CTX is actually specified then it sets the SELinux or SMACK security context to CTX. choose your own adventure fr fr π-h,--helpβ Print help. she'll tell you everything π-V,--versionβ Print version. who is she? what era? find out π
and the positional cuties:
<NAME>β name of the new file. you name it, she claims it π«<TYPE>β type of the new file, and it has to be one ofb,c,uorpβ[major]β major file type π’[minor]β minor file type π’
π₯ EXTRA π₯
okay so real talk β mandatory arguments to long options are mandatory for short options too. the rules apply both ways, no exceptions bestie.
-m, --mode=MODE set file permission bits to MODE, not a=rw - umask
now the important part, so listen up π«Ά:
Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they must be omitted when TYPE is p. so like, no half-effort major-only moment. it's both or neither. periodt.
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. yes she's multilingual in number bases, we stan an educated queen π
TYPE may be:
bβ create a block (buffered) special file π§±c,uβ create a character (unbuffered) special file π€pβ create a FIFO π°
β οΈ NOTE: your shell may have its own version of mknod, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports. like, check before you wreck, bestie π
π VERSION π
v(uutils coreutils) 0.12.0
that's the era we're in β¨
π EXAMPLES π
Create a block device:
sudo mknod path/to/device_file b major_device_number minor_device_number
Create a character device:
sudo mknod path/to/device_file c major_device_number minor_device_number
Create a FIFO (queue) device:
sudo mknod path/to/device_file p
Create a device file with default SELinux security context:
sudo mknod [-Z|--context] path/to/device_file type major_device_number
minor_device_number
π ngl, the examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail. so if one acts up, it's not you, it's the WIP energy π
okay that's the whole page, you ate that π remember: she creates special files, she's got range, and she's been sitting in the General Commands Manual since the very 2026-09-25 date stamp on the bottom of the mknod(1) page. mwah π bye bestie! π§
π¦ where this page comes from
- ubuntu stonking: rust-coreutils 0.12.0-1ubuntu2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms