Major and Minor numbers in Linux kernel

Linux School Tech
16 min readJul 1, 2024

--

In the Linux kernel, “major” and “minor” are two distinct concepts that refer to the way the kernel organizes and manages devices.

Major number

A major number is a unique identifier assigned to a device driver in the Linux kernel. Each device driver has a unique major number, which is used by the kernel to identify the device and determine which driver to use when a device is accessed. The major number is also known as the “device number” or “device major”.

For example, the major number for the first hard disk drive (HDD) is typically 8, while the major number for the first USB drive is typically 179. You can use the ls -l /dev command to see a list of devices and their corresponding major numbers.

Minor number

A minor number is a smaller identifier that is used in conjunction with the major number to uniquely identify a specific device within a class of devices. Minor numbers are used to identify specific devices within a major device class, such as different partitions on a hard disk drive or different USB drives.

For example, if you have two hard disk drives with major number 8, one with minor number 0 and another with minor number 1, they would be identified as /dev/sda (minor 0) and /dev/sdb (minor 1).

The purpose of major and minor numbers

In the context of computer file systems, major and minor numbers are used to identify specific devices or types of operations within a device.

A major number identifies a particular driver or device type in the kernel of an operating system. For example, all block devices (such as hard drives and USB flash drives) might be assigned major number 8, while character devices (such as serial ports and keyboards) might be assigned major number 5.

Once a major number has been identified, a minor number is then used to distinguish between different instances of that device type or operation. For instance, if two hard drives are connected to a system, they would both have the same major number for the block device driver, but distinct minor numbers to indicate which physical drive each one corresponds to.

In summary, major and minor numbers provide a way to uniquely identify specific devices or operations in a file system hierarchy, allowing the operating system’s kernel to efficiently manage resources and communicate with hardware components.

Where are the device files?

The Linux kernel implements major and minor numbers through its device filesystem, known as devfs . Device nodes in Linux represent actual hardware devices or virtual devices such as pseudoterminals.

ls -l /dev

crw-r--r-- 1 root root 10, 235 Jul 1 08:13 autofs
drwxr-xr-x 2 root root 600 Jul 1 12:21 block
drwxr-xr-x 2 root root 60 Jul 1 08:13 bsg
crw-rw---- 1 root disk 10, 234 Jul 1 08:13 btrfs-control
drwxr-xr-x 3 root root 60 Jul 1 08:13 bus
lrwxrwxrwx 1 root root 3 Jul 1 08:13 cdrom -> sr0
drwxr-xr-x 2 root root 4800 Jul 1 12:21 char
crw--w---- 1 root tty 5, 1 Jul 1 08:13 console
lrwxrwxrwx 1 root root 11 Jul 1 08:13 core -> /proc/kcore
drwxr-xr-x 14 root root 280 Jul 1 12:21 cpu
crw------- 1 root root 10, 123 Jul 1 08:13 cpu_dma_latency
crw------- 1 root root 10, 203 Jul 1 08:13 cuse
drwxr-xr-x 8 root root 160 Jul 1 08:13 disk
drwxr-xr-x 2 root root 60 Jul 1 08:13 dma_heap
drwxr-xr-x 3 root root 100 Jul 1 08:13 dri
crw------- 1 root root 235, 0 Jul 1 08:13 drm_dp_aux0
crw------- 1 root root 10, 125 Jul 1 08:13 ecryptfs
crw-rw---- 1 root video 29, 0 Jul 1 08:13 fb0
lrwxrwxrwx 1 root root 13 Jul 1 08:13 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Jul 1 08:13 full
crw-rw-rw- 1 root root 10, 229 Jul 1 08:13 fuse
crw------- 1 root root 254, 0 Jul 1 08:13 gpiochip0
crw------- 1 root root 239, 0 Jul 1 08:13 hidraw0
crw------- 1 root root 239, 1 Jul 1 08:13 hidraw1
crw------- 1 root root 239, 2 Jul 1 08:13 hidraw2
crw------- 1 root root 10, 228 Jul 1 08:13 hpet
drwxr-xr-x 2 root root 0 Jul 1 08:13 hugepages
crw------- 1 root root 10, 183 Jul 1 08:13 hwrng
crw------- 1 root root 89, 0 Jul 1 08:13 i2c-0
crw------- 1 root root 89, 1 Jul 1 08:13 i2c-1
crw------- 1 root root 89, 10 Jul 1 08:13 i2c-10
crw------- 1 root root 89, 11 Jul 1 08:13 i2c-11
crw------- 1 root root 89, 2 Jul 1 08:13 i2c-2
crw------- 1 root root 89, 3 Jul 1 08:13 i2c-3
crw------- 1 root root 89, 4 Jul 1 08:13 i2c-4
crw------- 1 root root 89, 5 Jul 1 08:13 i2c-5
crw------- 1 root root 89, 6 Jul 1 08:13 i2c-6
crw------- 1 root root 89, 7 Jul 1 08:13 i2c-7
crw------- 1 root root 89, 8 Jul 1 08:13 i2c-8
crw------- 1 root root 89, 9 Jul 1 08:13 i2c-9
lrwxrwxrwx 1 root root 12 Jul 1 08:13 initctl -> /run/initctl
drwxr-xr-x 4 root root 540 Jul 1 08:13 input
crw-r--r-- 1 root root 1, 11 Jul 1 08:13 kmsg
crw-rw----+ 1 root kvm 10, 232 Jul 1 08:13 kvm
lrwxrwxrwx 1 root root 28 Jul 1 08:13 log -> /run/systemd/journal/dev-log
brw-rw---- 1 root disk 7, 0 Jul 1 08:13 loop0
brw-rw---- 1 root disk 7, 1 Jul 1 08:13 loop1
brw-rw---- 1 root disk 7, 10 Jul 1 08:13 loop10
brw-rw---- 1 root disk 7, 11 Jul 1 08:13 loop11
brw-rw---- 1 root disk 7, 12 Jul 1 08:13 loop12
brw-rw---- 1 root disk 7, 13 Jul 1 08:13 loop13
brw-rw---- 1 root disk 7, 14 Jul 1 08:13 loop14
brw-rw---- 1 root disk 7, 15 Jul 1 08:13 loop15
brw-rw---- 1 root disk 7, 16 Jul 1 08:13 loop16
brw-rw---- 1 root disk 7, 17 Jul 1 08:13 loop17
brw-rw---- 1 root disk 7, 18 Jul 1 08:13 loop18
brw-rw---- 1 root disk 7, 19 Jul 1 08:13 loop19
brw-rw---- 1 root disk 7, 2 Jul 1 08:13 loop2
brw-rw---- 1 root disk 7, 20 Jul 1 08:13 loop20
brw-rw---- 1 root disk 7, 21 Jul 1 08:13 loop21
brw-rw---- 1 root disk 7, 3 Jul 1 08:13 loop3
brw-rw---- 1 root disk 7, 4 Jul 1 08:13 loop4
brw-rw---- 1 root disk 7, 5 Jul 1 08:13 loop5
brw-rw---- 1 root disk 7, 6 Jul 1 08:13 loop6
brw-rw---- 1 root disk 7, 7 Jul 1 08:13 loop7
brw-rw---- 1 root disk 7, 8 Jul 1 08:13 loop8
brw-rw---- 1 root disk 7, 9 Jul 1 08:13 loop9
crw-rw---- 1 root disk 10, 237 Jul 1 08:13 loop-control
drwxr-xr-x 2 root root 60 Jul 1 08:13 mapper
crw------- 1 root root 10, 227 Jul 1 08:13 mcelog
crw------- 1 root root 238, 0 Jul 1 08:13 mei0
crw-r----- 1 root kmem 1, 1 Jul 1 08:13 mem
drwxrwxrwt 2 root root 40 Jul 1 08:13 mqueue
drwxr-xr-x 3 root root 60 Jul 1 08:13 mtd
crw------- 1 root root 90, 0 Jul 1 08:13 mtd0
crw------- 1 root root 90, 1 Jul 1 08:13 mtd0ro
drwxr-xr-x 2 root root 60 Jul 1 08:13 net
crw------- 1 root root 240, 0 Jul 1 08:13 ng0n1
crw-rw-rw- 1 root root 1, 3 Jul 1 08:13 null
crw------- 1 root root 241, 0 Jul 1 12:21 nvme0
brw-rw---- 1 root disk 259, 0 Jul 1 08:13 nvme0n1
brw-rw---- 1 root disk 259, 1 Jul 1 08:13 nvme0n1p1
brw-rw---- 1 root disk 259, 2 Jul 1 08:13 nvme0n1p2
brw-rw---- 1 root disk 259, 3 Jul 1 08:13 nvme0n1p3
brw-rw---- 1 root disk 259, 4 Jul 1 08:13 nvme0n1p4
crw------- 1 root root 10, 122 Jul 1 08:13 nvme-fabrics
crw------- 1 root root 10, 144 Jul 1 08:13 nvram
crw-r----- 1 root kmem 1, 4 Jul 1 08:13 port
crw------- 1 root root 108, 0 Jul 1 08:13 ppp
crw------- 1 root root 10, 1 Jul 1 08:13 psaux
crw-rw-rw- 1 root tty 5, 2 Jul 1 16:41 ptmx
drwxr-xr-x 2 root root 0 Jul 1 08:13 pts
crw-rw-rw- 1 root root 1, 8 Jul 1 08:13 random
crw-rw-r--+ 1 root netdev 10, 242 Jul 1 08:13 rfkill
lrwxrwxrwx 1 root root 4 Jul 1 08:13 rtc -> rtc0
crw------- 1 root root 248, 0 Jul 1 08:13 rtc0
crw-rw----+ 1 root cdrom 21, 0 Jul 1 08:13 sg0
drwxrwxrwt 2 root root 40 Jul 1 16:41 shm
crw------- 1 root root 10, 231 Jul 1 08:13 snapshot
drwxr-xr-x 3 root root 320 Jul 1 08:13 snd
brw-rw----+ 1 root cdrom 11, 0 Jul 1 12:21 sr0
lrwxrwxrwx 1 root root 15 Jul 1 08:13 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Jul 1 08:13 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Jul 1 08:13 stdout -> /proc/self/fd/1
crw-rw---- 1 tss root 10, 224 Jul 1 08:13 tpm0
crw-rw---- 1 tss tss 253, 65536 Jul 1 08:13 tpmrm0
crw-rw-rw- 1 root tty 5, 0 Jul 1 16:12 tty
crw--w---- 1 root tty 4, 0 Jul 1 08:13 tty0
crw--w---- 1 root tty 4, 1 Jul 1 08:13 tty1
crw--w---- 1 root tty 4, 10 Jul 1 08:13 tty10
crw--w---- 1 root tty 4, 11 Jul 1 08:13 tty11
crw--w---- 1 root tty 4, 12 Jul 1 08:13 tty12
crw--w---- 1 root tty 4, 13 Jul 1 08:13 tty13
crw--w---- 1 root tty 4, 14 Jul 1 08:13 tty14
crw--w---- 1 root tty 4, 15 Jul 1 08:13 tty15
crw--w---- 1 root tty 4, 16 Jul 1 08:13 tty16
crw--w---- 1 root tty 4, 17 Jul 1 08:13 tty17
crw--w---- 1 root tty 4, 18 Jul 1 08:13 tty18
crw--w---- 1 root tty 4, 19 Jul 1 08:13 tty19
crw--w---- 1 root tty 4, 2 Jul 1 08:13 tty2
crw--w---- 1 root tty 4, 20 Jul 1 08:13 tty20
crw--w---- 1 root tty 4, 21 Jul 1 08:13 tty21
crw--w---- 1 root tty 4, 22 Jul 1 08:13 tty22
crw--w---- 1 root tty 4, 23 Jul 1 08:13 tty23
crw--w---- 1 root tty 4, 24 Jul 1 08:13 tty24
crw--w---- 1 root tty 4, 25 Jul 1 08:13 tty25
crw--w---- 1 root tty 4, 26 Jul 1 08:13 tty26
crw--w---- 1 root tty 4, 27 Jul 1 08:13 tty27
crw--w---- 1 root tty 4, 28 Jul 1 08:13 tty28
crw--w---- 1 root tty 4, 29 Jul 1 08:13 tty29
crw--w---- 1 root tty 4, 3 Jul 1 08:13 tty3
crw--w---- 1 root tty 4, 30 Jul 1 08:13 tty30
crw--w---- 1 root tty 4, 31 Jul 1 08:13 tty31
crw--w---- 1 root tty 4, 32 Jul 1 08:13 tty32
crw--w---- 1 root tty 4, 33 Jul 1 08:13 tty33
crw--w---- 1 root tty 4, 34 Jul 1 08:13 tty34
crw--w---- 1 root tty 4, 35 Jul 1 08:13 tty35
crw--w---- 1 root tty 4, 36 Jul 1 08:13 tty36
crw--w---- 1 root tty 4, 37 Jul 1 08:13 tty37
crw--w---- 1 root tty 4, 38 Jul 1 08:13 tty38
crw--w---- 1 root tty 4, 39 Jul 1 08:13 tty39
crw--w---- 1 root tty 4, 4 Jul 1 08:13 tty4
crw--w---- 1 root tty 4, 40 Jul 1 08:13 tty40
crw--w---- 1 root tty 4, 41 Jul 1 08:13 tty41
crw--w---- 1 root tty 4, 42 Jul 1 08:13 tty42
crw--w---- 1 root tty 4, 43 Jul 1 08:13 tty43
crw--w---- 1 root tty 4, 44 Jul 1 08:13 tty44
crw--w---- 1 root tty 4, 45 Jul 1 08:13 tty45
crw--w---- 1 root tty 4, 46 Jul 1 08:13 tty46
crw--w---- 1 root tty 4, 47 Jul 1 08:13 tty47
crw--w---- 1 root tty 4, 48 Jul 1 08:13 tty48
crw--w---- 1 root tty 4, 49 Jul 1 08:13 tty49
crw--w---- 1 root tty 4, 5 Jul 1 08:13 tty5
crw--w---- 1 root tty 4, 50 Jul 1 08:13 tty50
crw--w---- 1 root tty 4, 51 Jul 1 08:13 tty51
crw--w---- 1 root tty 4, 52 Jul 1 08:13 tty52
crw--w---- 1 root tty 4, 53 Jul 1 08:13 tty53
crw--w---- 1 root tty 4, 54 Jul 1 08:13 tty54
crw--w---- 1 root tty 4, 55 Jul 1 08:13 tty55
crw--w---- 1 root tty 4, 56 Jul 1 08:13 tty56
crw--w---- 1 root tty 4, 57 Jul 1 08:13 tty57
crw--w---- 1 root tty 4, 58 Jul 1 08:13 tty58
crw--w---- 1 root tty 4, 59 Jul 1 08:13 tty59
crw--w---- 1 root tty 4, 6 Jul 1 08:13 tty6
crw--w---- 1 root tty 4, 60 Jul 1 08:13 tty60
crw--w---- 1 root tty 4, 61 Jul 1 08:13 tty61
crw--w---- 1 root tty 4, 62 Jul 1 08:13 tty62
crw--w---- 1 root tty 4, 63 Jul 1 08:13 tty63
crw--w---- 1 root tty 4, 7 Jul 1 08:13 tty7
crw--w---- 1 root tty 4, 8 Jul 1 08:13 tty8
crw--w---- 1 root tty 4, 9 Jul 1 08:13 tty9
crw------- 1 root root 5, 3 Jul 1 08:13 ttyprintk
crw-rw---- 1 root dialout 4, 64 Jul 1 08:13 ttyS0
crw-rw---- 1 root dialout 4, 65 Jul 1 08:13 ttyS1
crw-rw---- 1 root dialout 4, 74 Jul 1 08:13 ttyS10
crw-rw---- 1 root dialout 4, 75 Jul 1 08:13 ttyS11
crw-rw---- 1 root dialout 4, 76 Jul 1 08:13 ttyS12
crw-rw---- 1 root dialout 4, 77 Jul 1 08:13 ttyS13
crw-rw---- 1 root dialout 4, 78 Jul 1 08:13 ttyS14
crw-rw---- 1 root dialout 4, 79 Jul 1 08:13 ttyS15
crw-rw---- 1 root dialout 4, 80 Jul 1 08:13 ttyS16
crw-rw---- 1 root dialout 4, 81 Jul 1 08:13 ttyS17
crw-rw---- 1 root dialout 4, 82 Jul 1 08:13 ttyS18
crw-rw---- 1 root dialout 4, 83 Jul 1 08:13 ttyS19
crw-rw---- 1 root dialout 4, 66 Jul 1 08:13 ttyS2
crw-rw---- 1 root dialout 4, 84 Jul 1 08:13 ttyS20
crw-rw---- 1 root dialout 4, 85 Jul 1 08:13 ttyS21
crw-rw---- 1 root dialout 4, 86 Jul 1 08:13 ttyS22
crw-rw---- 1 root dialout 4, 87 Jul 1 08:13 ttyS23
crw-rw---- 1 root dialout 4, 88 Jul 1 08:13 ttyS24
crw-rw---- 1 root dialout 4, 89 Jul 1 08:13 ttyS25
crw-rw---- 1 root dialout 4, 90 Jul 1 08:13 ttyS26
crw-rw---- 1 root dialout 4, 91 Jul 1 08:13 ttyS27
crw-rw---- 1 root dialout 4, 92 Jul 1 08:13 ttyS28
crw-rw---- 1 root dialout 4, 93 Jul 1 08:13 ttyS29
crw-rw---- 1 root dialout 4, 67 Jul 1 08:13 ttyS3
crw-rw---- 1 root dialout 4, 94 Jul 1 08:13 ttyS30
crw-rw---- 1 root dialout 4, 95 Jul 1 08:13 ttyS31
crw-rw---- 1 root dialout 4, 68 Jul 1 08:13 ttyS4
crw-rw---- 1 root dialout 4, 69 Jul 1 08:13 ttyS5
crw-rw---- 1 root dialout 4, 70 Jul 1 08:13 ttyS6
crw-rw---- 1 root dialout 4, 71 Jul 1 08:13 ttyS7
crw-rw---- 1 root dialout 4, 72 Jul 1 08:13 ttyS8
crw-rw---- 1 root dialout 4, 73 Jul 1 08:13 ttyS9
crw-rw---- 1 root kvm 10, 124 Jul 1 08:13 udmabuf
crw------- 1 root root 10, 239 Jul 1 08:13 uhid
crw------- 1 root root 10, 223 Jul 1 08:13 uinput
crw-rw-rw- 1 root root 1, 9 Jul 1 08:13 urandom
drwxr-xr-x 2 root root 60 Jul 1 08:13 usb
crw------- 1 root root 10, 126 Jul 1 08:13 userfaultfd
crw------- 1 root root 10, 240 Jul 1 08:13 userio
crw------- 1 root root 10, 121 Jul 1 08:13 vboxdrv
crw-rw-rw- 1 root root 10, 120 Jul 1 08:13 vboxdrvu
crw------- 1 root root 10, 119 Jul 1 08:13 vboxnetctl
drwxr-x--- 3 root vboxusers 60 Jul 1 08:13 vboxusb
crw-rw---- 1 root tty 7, 0 Jul 1 08:13 vcs
crw-rw---- 1 root tty 7, 1 Jul 1 08:13 vcs1
crw-rw---- 1 root tty 7, 2 Jul 1 08:13 vcs2
crw-rw---- 1 root tty 7, 3 Jul 1 08:13 vcs3
crw-rw---- 1 root tty 7, 4 Jul 1 08:13 vcs4
crw-rw---- 1 root tty 7, 5 Jul 1 08:13 vcs5
crw-rw---- 1 root tty 7, 6 Jul 1 08:13 vcs6
crw-rw---- 1 root tty 7, 128 Jul 1 08:13 vcsa
crw-rw---- 1 root tty 7, 129 Jul 1 08:13 vcsa1
crw-rw---- 1 root tty 7, 130 Jul 1 08:13 vcsa2
crw-rw---- 1 root tty 7, 131 Jul 1 08:13 vcsa3
crw-rw---- 1 root tty 7, 132 Jul 1 08:13 vcsa4
crw-rw---- 1 root tty 7, 133 Jul 1 08:13 vcsa5
crw-rw---- 1 root tty 7, 134 Jul 1 08:13 vcsa6
crw-rw---- 1 root tty 7, 64 Jul 1 08:13 vcsu
crw-rw---- 1 root tty 7, 65 Jul 1 08:13 vcsu1
crw-rw---- 1 root tty 7, 66 Jul 1 08:13 vcsu2
crw-rw---- 1 root tty 7, 67 Jul 1 08:13 vcsu3
crw-rw---- 1 root tty 7, 68 Jul 1 08:13 vcsu4
crw-rw---- 1 root tty 7, 69 Jul 1 08:13 vcsu5
crw-rw---- 1 root tty 7, 70 Jul 1 08:13 vcsu6
drwxr-xr-x 2 root root 60 Jul 1 08:13 vfio
crw------- 1 root root 10, 127 Jul 1 08:13 vga_arbiter
crw------- 1 root root 10, 137 Jul 1 08:13 vhci
crw-rw---- 1 root kvm 10, 238 Jul 1 08:13 vhost-net
crw-rw---- 1 root kvm 10, 241 Jul 1 08:13 vhost-vsock
crw-rw-rw- 1 root root 1, 5 Jul 1 08:13 zero
crw------- 1 root root 10, 249 Jul 1 08:13 zfs

When a new device is detected by the kernel, it creates a device node with a unique name in the appropriate directory of the devfs filesystem. This device node includes attributes for various properties of the device, including its major and minor numbers. These values are typically set during the initialization of the device driver.

The major number is associated with the driver responsible for managing the device. When a process issues a system call involving a device file, the kernel uses the major number to determine which driver should handle the request. If no suitable driver is found, the system call will fail.

The minor number is used to further distinguish between similar devices managed by the same driver. Different drivers may use these numbers differently; some use them to select sub-functions of the device, others use them to address individual channels on multi-channel devices, and still others simply assign them sequentially without any special meaning.

Device nodes can also be created manually using the mknod command, specifying the desired major and minor numbers along with other parameters. However, most often, device nodes are automatically created and destroyed by udev, a userspace daemon designed to simplify device management and allow customization of device naming schemes.

Overall, the implementation of major and minor numbers in the Linux kernel provides a flexible framework for managing diverse sets of devices and their respective drivers. By abstracting away low-level details of hardware access, it enables higher-level software components to interact seamlessly with underlying hardware resources.

Major Numbers of Block Devices (Storage Devices)

In Linux, each type of block device is assigned a unique major number, which the kernel uses to identify the driver associated with the device. Here are the major numbers for various types of block devices:

IDE (Integrated Drive Electronics) Disks

Major number: 3, 22

SATA (Serial ATA) Disks

These typically fall under the SCSI subsystem and can have major numbers 8, 65–71, 128–135.

SSD (Solid State Drive)

SSDs can use various interfaces (SATA, NVMe, etc.), so their major numbers depend on the interface. For SATA SSDs, it would be the same as SATA disks (major numbers 8, 65–71, 128–135).

NVMe (Non-Volatile Memory Express) Devices

Major number: 259

NVME device major number is 259
Minor numbers differences, for NVME0 disk sub-partitions

RAID (Redundant Array of Independent Disks) Devices

For software RAID using the md (Multiple Devices) driver: Major number: 9

SCSI (Small Computer System Interface) Disks

Major numbers: 8, 65–71, 128–135

USB (Universal Serial Bus) Storage Devices

USB storage devices also use the SCSI subsystem, so their major numbers would typically be the same: 8, 65–71, 128–135.

Optical Disks (CD/DVD)

Major number: 11

These major numbers are defined in the kernel source code, specifically in the Documentation/admin-guide/devices.txt file and corresponding driver files. For more precise and updated information, referring to the latest version of the Linux kernel source is recommended.

TTY Devices

The major numbers for /dev/tty and /dev/tty0, /dev/tty1, /dev/tty2, etc., differ because they represent different types of terminal devices within the Linux kernel. Here is an explanation of these differences:

/dev/tty

  • Description: The /dev/tty device is a special device file that represents the controlling terminal for the current process. It is not tied to any specific physical or virtual terminal device but rather to the terminal associated with the current session.
  • Major Number: The major number for /dev/tty is typically 5.
  • Minor Number: The minor number for /dev/tty is always 0.
  • Use Case: When a process wants to write to the terminal that it was started from, it can open /dev/tty to get the terminal associated with that process.

/dev/tty0, /dev/tty1, /dev/tty2, etc.

  • Description: These device files represent specific virtual consoles (also known as virtual terminals) on the system. Virtual consoles provide a way to have multiple terminal sessions running simultaneously, which can be switched between using key combinations (e.g., Ctrl+Alt+F1, Ctrl+Alt+F2, etc.).
  • Major Number: The major number for these devices is typically 4.
  • For example, /dev/tty0 to /dev/tty63 usually have major number 4.
  • Minor Number: The minor numbers are different for each console:
  • /dev/tty0 has minor number 0 and often represents the currently active virtual console.
  • /dev/tty1 has minor number 1, /dev/tty2 has minor number 2, and so on.
  • Use Case: These are used to interact with the virtual console system. Each virtual console can be used for login sessions, running text-based applications, etc.

The virtual console system allows a user to switch between multiple terminal sessions using keyboard shortcuts. For example, Ctrl+Alt+F1 might take you to /dev/tty1, while Ctrl+Alt+F2 takes you to /dev/tty2, and so on.

The /dev/console device is another related terminal device with major number 5 and minor number 1, representing the system console.

My YouTube Channel

More shell script videos and linux tutorials on my YouTube Channel.

--

--

Linux School Tech

Interested in Linux 🐧 and bash programming 👨‍💻 Python 🐍 Data structures and Algorithms e = ∑∞ⁿ⁼⁰ ¹ₙ https://www.youtube.com/@linuxadminhacks