1

In Linux, the device files in /dev have major and minor numbers:

# ll /dev
...
crw--w----   1 root tty         4,     8 Jan  5 09:02 tty8
crw--w----   1 root tty         4,     9 Jan  5 09:02 tty9
crw-rw----   1 root dialout     4,    64 Jan  5 09:02 ttyS0
crw-rw----   1 root dialout     4,    65 Jan  5 09:02 ttyS1
crw-rw----   1 root dialout     4,    66 Jan  5 09:02 ttyS2
crw-rw----   1 root dialout     4,    67 Jan  5 09:02 ttyS3
crw-------   1 root root       10,   239 Jan  5 09:02 uhid
crw-------   1 root root       10,   223 Jan  5 09:02 uinput
crw-rw-rw-   1 root root        1,     9 Jan  5 09:02 urandom
...

The major number corresponds to a device driver / kernel module, and I assume that I can determine which module handles each major number, by inpecting the kernel code and other documentation; but is there a command or other way to find out from the running system?

1 Answer 1

1

Yes, you can find out which majors correspond to which drivers by looking at /proc/devices; for example

$ cat /proc/devices
Character devices:
  1 mem
  4 /dev/vc/0   
  4 tty
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx   
[...]
246 cec
247 hidraw
248 firewire
249 ptp
250 pps
251 bsg
252 rtc
253 dax
254 gpiochip
[...]

Block devices:  
  7 loop
  8 sd
  9 md
 11 sr
 65 sd
 66 sd
 67 sd
 68 sd
 69 sd
 70 sd
 71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
251 zram
252 pktcdvd
253 mdp
254 device-mapper
259 blkext

The advantage of this is that it shows dynamic assignments on your system, on top of the kernel’s static assignments.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .