• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

mknod: command not found

by Deepika

“mknod” is a command-line tool in Linux used to create special files, also known as device files, that represent a device, such as a disk, a partition, a terminal, or a device connected to the system through a device driver. Special files are located in the /dev directory and act as interface points between the operating system and the physical devices.

The “mknod” command takes several arguments, including the name of the special file, the type of file (block or character), and the major and minor device numbers. The major device number identifies the device driver associated with the device, while the minor device number identifies a specific instance of the device.

There are two types of special files: block and character. Block special files represent devices that handle data in blocks, such as disks, while character special files represent devices that handle data as a stream of characters, such as terminals. The “mknod” command can be used to create either type of special file.

It’s worth noting that in modern Linux systems, special files are often created automatically by the system, and manual creation with “mknod” is rarely needed. However, it is still a useful tool for advanced users who need to create custom device files or troubleshoot issues with device files.

If you encounter the below error while running the command mknod:

mknod: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install coreutils
Ubuntu apt-get install coreutils
Alpine apk add coreutils
Arch Linux pacman -S coreutils
Kali Linux apt-get install coreutils
CentOS yum install coreutils
Fedora dnf install coreutils
OS X brew install coreutils
Raspbian apt-get install coreutils

mknod Command Examples

1. Create a block device:

# sudo mknod path/to/device_file b major_device_number minor_device_number

2. Create a character device:

# sudo mknod path/to/device_file c major_device_number minor_device_number

3. Create a FIFO (queue) device:

# sudo mknod path/to/device_file p

4. Create a device file with default SELinux security context:

# sudo mknod -Z path/to/device_file type major_device_number minor_device_number

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to configure Partitioned Block Devices (Non-ASMLIB) And Assign Them To ASM
  2. DHCP configuration file /etc/dhcp/dhcpd.conf explained
  3. How to disable NetworkManager on CentOS / RHEL 7
  4. “Metadata File Does Not Match Checksum” Issue When Yum Installs or Updates Package
  5. How to Restart Network Services in CentOS/RHEL 8
  6. getfacl Command Examples in Linux
  7. ipcalc: command not found
  8. What are the Network Bonding Modes In CentOS / RHEL
  9. getenforce: command not found
  10. archlinux-java Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright