(Not a duplicate of Understanding /dev and its subdirs and files)I was browsing around my filesystem and for the first time I took a second to analyze my /dev directory. I was surprised by the amount of devices files in it, and couldn't make sense of all of them:max@linux-vwzy:/dev> lsadsp             disk      fd0u1760  initctl  mem                 root  sg0       tty    tty21  tty35  tty49  tty62    vboxdrv     vcsa2audio            dri       fd0u1840  input    mixer               rtc   sg1       tty0   tty22  tty36  tty5   tty63    vboxnetctl  vcsa3autofs           dsp       fd0u1920  kmem     mixer1              rtc0  sg2       tty1   tty23  tty37  tty50  tty7     vboxusb     vcsa4block            dvd       fd0u360   kmsg     net                 scd0  sg3       tty10  tty24  tty38  tty51  tty8     vcs         vcsa5bootsplash       dvdrw     fd0u720   log      network_latency     sda   sg4       tty11  tty25  tty39  tty52  tty9     vcs1        vcsa6bsg              fb0       fd0u800   loop0    network_throughput  sda1  sg5       tty12  tty26  tty4   tty53  ttyS0    vcs10       vcsa7btrfs-control    fd        fd0u820   loop1    null                sda2  sg6       tty13  tty27  tty40  tty54  ttyS1    vcs2        vga_arbiterbus              fd0       fd0u830   loop2    nvram               sda3  sg7       tty14  tty28  tty41  tty55  ttyS2    vcs3        xconsolecdrom            fd0u1040  full      loop3    oldmem              sdb   shm       tty15  tty29  tty42  tty56  ttyS3    vcs4        zerocdrw             fd0u1120  fuse      loop4    port                sdc   snapshot  tty16  tty3   tty43  tty57  ttyS4    vcs5char             fd0u1440  fw0       loop5    ppp                 sdc1  snd       tty17  tty30  tty44  tty58  ttyS5    vcs6console          fd0u1600  hidraw0   loop6    psaux               sdd   sr0       tty18  tty31  tty45  tty59  ttyS6    vcs7core             fd0u1680  hidraw1   loop7    ptmx                sde   stderr    tty19  tty32  tty46  tty6   ttyS7    vcsacpu              fd0u1722  hidraw2   mapper   pts                 sdf   stdin     tty2   tty33  tty47  tty60  uinput   vcsa1cpu_dma_latency  fd0u1743  hpet      mcelog   random              sdg   stdout    tty20  tty34  tty48  tty61  urandom  vcsa10I know that the sd*'s are my disks and filesystems, but what are loopx, fd0uxxxx, sgx, vcsxxx and all the other single files. Most of them are device files according to ls.I understand that fully answering this question would require a ton of information, so unless someone can provide a link with a great rundown of the different devices files in dev and what they are all used for, I propose we make a CW answer.
What do the device files in /dev actually do?
filesystems;devices
Some of these have man pages (in section 4; leave out the final digit(s) and in a few cases such as sda the final letter).For a more definitive, but usually less easy to read answer, look in the kernel documentation. First determine whether the device is a block device or a character device, and its major and minor number. For example$ ls -l /dev/sdabrw-rw---- 1 root disk 8, 0 Jul 12 15:54 /dev/sdaso sda is a block device (b) with major:minor = 8:0. Now look it up in devices.txt: 8 block is SCSI disk devices, which are most disks nowadays (most IDE and SATA disks are seen through the SCSI interface too, though this depends on kernel compilation options). Block device 8:1 (/dev/sda1) is the first partition of /dev/sda.There may be a few oddball devices that aren't documented. You can look on your system at e.g. /sys/dev/block/8:0: this is a symbolic link to a directory under /sys that provides various pieces of information about the device. You can follow more links, and in particular (in this case) /sys/dev/block/8:0/device/driver lands you to a directory that corresponds with the driver. Another source of information is /proc/devices, which indicates what driver claims each major device number.Most Linux systems use udev to populate /dev based on available drivers and hardware. You can browse the rules to create device files, typically in /lib/udev/rules.d and /etc/udev/rules.d (the exact locations are distribution-dependant).A few of the files aren't devices. lsof /dev/NAME (as root) will tell you to what process is using them and thus give you a hint at what they are for. For the directories, look at the files in them.This answer is specific to Linux, but other unices follow the same principles. Check the man pages (in section 4 on most variants, but a few use section 7), or other system or kernel documentation. The relevant information is the block/character bit and the major:minor numbers.