Forrest logo
back to the mknod tool

mknod:tldr:98823

mknod: Create a block device.
$ sudo mknod ${path-to-device_file} b ${major_device_number} ${minor_device_number}
try on your machine

This command creates a special file known as a device file in Linux systems. Here is a breakdown of the command:

  • sudo: This command is used to execute the subsequent command with administrative privileges. It allows the command to be run as the root user or with root privileges.
  • mknod: This is the command used to create a device file in Linux. It stands for "make node."
  • ${path-to-device_file}: This is the path where the device file will be created. You should replace it with the actual path you want the device file to be located.
  • b: This specifies the type of device file to be created. In this case, it indicates a block device. Block devices are used for random access storage devices, like hard drives or flash drives.
  • ${major_device_number}: This is the major device number assigned to the device file. It signifies the type of device or driver associated with the file.
  • ${minor_device_number}: This is the minor device number assigned to the device file. It helps to identify a specific instance of a device or driver.

By running this command with the appropriate arguments, you can create a block device file with the specified major and minor device numbers at the specified path. These device files are important for interacting with hardware devices in a Unix-like operating system.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the mknod tool