Ls -l numbers between the size and the group

ls

when I run ls -l /dev/null /dev/zero /dev/tty I get:

crw-rw-rw- 1 root root 1, 3 Aug  9 09:05 /dev/null
crw-rw-rw- 1 root tty  5, 0 Aug  9 09:05 /dev/tty
crw-rw-rw- 1 root root 1, 5 Aug  9 09:05 /dev/zero

what do the numbers 1 and 5 (after the group) indicate?

Best Answer

Those files are special files called devices.

They don't have a size parameter, but two number called major and minor number.

Major is somehow related to type of device (terminal, disks, network interface, filesystems).

Minor is related instance number.

I use the word "related", you simply do not count, different disk might have different major number. Computing of this two value is complex, and is mostly done by your OS.

  • HP-UX use insf -e to create those device
  • Solaris use devfsadm -c disk for disk
  • AIX use cfgadm -a (from memory)

EDIT:

b) you seldom have a use for those number, as I mention misceleanous utilities manage them for you. a) you mostly cannot manualy compute those number. You know them or not. I use them only once, in HP-UX 11Iv1, volume group creation involve using mknod /dev/vgX c 64 0x010000 , 64 being major and 0X010000 being minor. It was user responsabilities to manage minor number.

Related Question