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 using a=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 of b, c, u or p ⭐
  • [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