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:
Example usage:
Typical workflow:
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:
/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:
Example:
Output includes:
- CPU model
- CPU cores
- CPU features
Example:
Displays memory usage information.
/proc for Processes¶
Each running process has its own directory.
Example:
Example:
Inside these directories you can inspect:
- process status
- open file descriptors
- memory maps
Example:
/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:
For example:
Shows all registered TTY devices.
Example:
Example: UART Device¶
Kernel device model:
Device file:
Relationship:
Example: Block Device¶
Example storage device:
Kernel information:
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:
Summary¶
Linux exposes system information and hardware interfaces through virtual file systems.
Important interfaces:
These interfaces allow user-space applications to interact with the Linux kernel and hardware in a standardized way.