Software & Apps Linux Linux System Administrator's Guide Create special device files to serve as Linux hardware interface by Juergen Haas Writer our editorial process Juergen Haas Updated on February 08, 2020 Linux Switching from Windows Tweet Share Email The mknod command creates the special device file in Linux that the operating system uses to interface with hardware. Linux Device Files In Linux, everything—even hardware—presents as a file to the operating system. Normally, Linux creates a file automatically when the OS recognizes a new device. For example, when you insert a USB drive, Linux mounts the USB drive and represents it as a new device file. Most device files reside in the /dev hierarchy of the root filesystem. The 'mknod' Command Most of the time, you'll never need to use mknod. It's primary purpose is to create a file that the Linux kernel recognizes as a device. The command takes the following syntax and options: mknod [option] name type [major minor] Options include: -m: Set file-permission bits to mode instead of umask.-Z: Set the SELinux security context to the default type. The name argument represents the name of the device. The type is either b (for a block special file), c or u (for an unbuffered file), or p (create a first-in/first-out file pipe). The options for major and minor are numbers that identify the type of the device. The list of these device numbers are kernel-specific; to identify them, you'll need to check the documentation for your specific distribution and kernel release. An example of mknod is: mknod /dev/fc1 b 1 2 In this case, the command creates a device file called /dev/fc1 that's a block device of major device number 1 and minor device number 2.