mknod
creates block devices, character devices, or FIFOs as special files
TLDR
SYNOPSIS
mknod [OPTION]... NAME TYPE [MAJOR MINOR]
DESCRIPTION
mknod creates block devices, character devices, or FIFOs (named pipes) as special files. Device files provide an interface between user programs and device drivers in the kernel.Block devices transfer data in fixed-size blocks and support buffering (e.g., hard drives). Character devices transfer data character by character without buffering (e.g., terminals, serial ports). FIFOs enable inter-process communication through a named file.Major and minor numbers identify the device driver and specific device instance. These numbers can be specified in decimal, octal (prefix 0), or hexadecimal (prefix 0x).
PARAMETERS
-m, --mode=MODE
Set file permission bits to MODE (symbolic or numeric), not the default a=rw minus umask.-Z
Set the SELinux security context to the default type.--context[=CTX]
Like -Z, or if CTX is specified set the SELinux or SMACK security context to CTX.--help
Display help and exit.--version
Output version information and exit.b
Create a block (buffered) special file; MAJOR and MINOR are required.c, u
Create a character (unbuffered) special file; MAJOR and MINOR are required.p
Create a FIFO (named pipe); MAJOR and MINOR must be omitted.
CAVEATS
Modern Linux systems use udev and devtmpfs for dynamic device node creation, making manual mknod usage rare. Creating device nodes requires root privileges. Incorrect major/minor numbers can cause system instability. The /dev directory is typically mounted as devtmpfs and managed automatically.
HISTORY
mknod is a standard Unix command dating back to early Unix systems. It is part of GNU coreutils on Linux. The command provides direct access to the mknod(2) system call for creating special files.
