Skip to content

Linux Device Interfaces

Linux exposes system and hardware information through several virtual file systems.

The three most important interfaces are:

  • /dev
  • /proc
  • /sys

These interfaces allow user applications to interact with the kernel and hardware.


/dev — Device Files

The /dev directory contains device nodes representing hardware devices.

Applications can interact with hardware by opening these files.

Examples:

/dev/ttyAMA10
/dev/spidev10.0
/dev/i2c-1
/dev/mmcblk0
/dev/random

Example usage:

echo "hello" > /dev/ttyAMA10
cat /dev/ttyAMA10

Typical workflow:

Application
open() / read() / write()
Kernel driver
Hardware

Device files are usually created automatically by the kernel and managed by udev.

Device types:

Type Example
Character device UART, SPI
Block device Storage
Pseudo device random

Examples:

Character device:
/dev/ttyAMA10
/dev/spidev10.0

Block device:
/dev/mmcblk0
/dev/sda

/proc — Kernel Information

/proc is a virtual filesystem that provides information about the kernel and running processes.

Files inside /proc are generated dynamically by the kernel.

Examples:

/proc/cpuinfo
/proc/meminfo
/proc/uptime
/proc/version

Example:

cat /proc/cpuinfo

Output includes:

  • CPU model
  • CPU cores
  • CPU features

Example:

cat /proc/meminfo

Displays memory usage information.


/proc for Processes

Each running process has its own directory.

Example:

/proc/<PID>

Example:

/proc/1
/proc/1234

Inside these directories you can inspect:

  • process status
  • open file descriptors
  • memory maps

Example:

/proc/1/status
/proc/1/fd
/proc/1/maps

/sys — Kernel Device Model

/sys is another virtual filesystem that exposes the Linux device model.

It provides structured information about:

  • devices
  • drivers
  • buses
  • kernel subsystems

Example:

/sys/class
/sys/devices
/sys/bus
/sys/block

For example:

/sys/class/tty

Shows all registered TTY devices.

Example:

ls /sys/class/tty

Example: UART Device

Kernel device model:

/sys/class/tty/ttyAMA10

Device file:

/dev/ttyAMA10

Relationship:

Kernel driver
/sys (device information)
/dev (device file)
User application

Example: Block Device

Example storage device:

/dev/mmcblk0

Kernel information:

/sys/block/mmcblk0

Information available:

  • device size
  • partitions
  • queue configuration

Differences Between /dev /proc /sys

Path Purpose
/dev Hardware device access
/proc Kernel and process information
/sys Kernel device model and configuration

Quick summary:

/dev  → access device
/proc → kernel information
/sys  → device structure

Summary

Linux exposes system information and hardware interfaces through virtual file systems.

Important interfaces:

/dev   → device nodes
/proc  → kernel information
/sys   → device model

These interfaces allow user-space applications to interact with the Linux kernel and hardware in a standardized way.