The concept behind major and minor
Character devices are populated in the /dev
directory. Do note that they are not only files present in that directory. A character device file is recognizable by its type, which we can display thanks to the ls -l
command. Major and minor identify and tie the devices with the drivers. Let'sseehow it works by listing the content of the/dev
directory (ls -l /dev
):
[...] drwxr-xr-x 2 root root 160 Mar 21 08:57 input crw-r----- 1 root kmem 1, 2 Mar 21 08:57 kmem lrwxrwxrwx 1 root root 28 Mar 21 08:57 log -> /run/systemd/journal/dev-log crw-rw---- 1 root disk 10, 237 Mar 21 08:57 loop-control brw-rw---- 1 root disk 7, 0 Mar 21 08:57 loop0 brw-rw---- 1 root disk 7, 1 Mar 21 08:57 loop1 brw-rw---- 1 root disk 7, 2 Mar 21 08:57 loop2 brw-rw---- 1 root disk 7, 3 Mar 21 08:57 loop3
Given the preceding excerpt, the first character of the first column identifies the file type. Possible values are:
c
: This is for character device filesb
: This is for block device filel...