mknod
system administrationLinux/Unix
The mknod command is one of the most frequently used commands in Linux/Unix-like operating systems. mknod Make block or character special files
Quick Reference
Command Name:
mknod
Category:
system administration
Platform:
Linux/Unix
Basic Usage:
mknod [options] [arguments]
Common Use Cases
Syntax
mknod [OPTION]... NAME TYPE [MAJOR MINOR]
Options
Option | Description |
---|---|
-m, --mode=MODE |
Set file permission bits to MODE, not a=rw - umask |
-Z |
Set SELinux security context of each created file to default type |
--context[=CTX] |
Like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX |
--help |
Display help information and exit |
--version |
Output version information and exit |
For the TYPE parameter, use one of the following:
Type | Description |
---|---|
b |
Create a block (buffered) special file |
c, u |
Create a character (unbuffered) special file |
p |
Create a FIFO (named pipe) |
Examples
How to Use These Examples
The examples below show common ways to use the mknod
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
sudo mknod /dev/null c 1 3