Skip to content

Linux mknod Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux mknod Guide

Complete beginner-friendly guide to mknod on Linux, covering Arch Linux, CachyOS, and other distributions including device node creation, special files, and device management.


Table of Contents

  1. Understanding mknod
  2. mknod Basics
  3. Device Types
  4. Creating Devices
  5. Troubleshooting

Understanding mknod

What is mknod?

mknod creates device nodes.

Uses:

  • Device nodes: Create special device files
  • Block devices: Create block device nodes
  • Character devices: Create character device nodes
  • FIFOs: Create named pipes

Warning: Requires root access. Use with caution.


mknod Basics

Create Device

Basic usage:

# Create device node
sudo mknod /dev/mynode c 1 3

# c = character device
# 1 = major number
# 3 = minor number

Named Pipe

Create FIFO:

# Create named pipe
mknod mypipe p

# p = pipe (FIFO)
# Or use: mkfifo mypipe

Device Types

Character Device

Character device:

# Character device
sudo mknod /dev/chardev c 1 1

# c = character device

Block Device

Block device:

# Block device
sudo mknod /dev/blockdev b 8 1

# b = block device

Creating Devices

Major/Minor Numbers

Device numbers:

# Character device with numbers
sudo mknod /dev/mydev c 10 1

# 10 = major number
# 1 = minor number

Permissions

Set permissions:

# With permissions
sudo mknod -m 666 /dev/mydev c 1 1

# -m = mode (666 permissions)

Troubleshooting

mknod Not Found

Check installation:

# mknod is part of coreutils
# Usually pre-installed

# Check mknod
which mknod

Summary

This guide covered mknod usage, device node creation, and device management for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally