I am trying to understand how linux filesystems work, but the only linux system I have is my android phone (rooted) so I am asking on the basis of what I see oin the android phone using adb shell.

From here and here I have read that every hardware connected to the android system is seen by the OS as a file. So /dev/dsp is the audio hardware, and writing anything into this file appears as sound through the speaker (so I am supposing if I write a stream of 1 byte characters in this file they will be interpreted as 2 byte words first, interleaved for left and right channel like in a wav file and played out through the speaker?). However going into /dev in adb shell and using the ls command I cannot see the dsp file.

My question is, is the naming of files in the /dev folder standard, or can it have any name? It says here that the naming can be completely random.

There is a naming scheme of sorts but in the vast majority of cases these are completely illogical.

If that's true then how can we know what file represents what?

  • According to Unix philosophy EVERYTHING is a file - that includes processes, devices etc Commented Nov 16, 2019 at 13:40
  • most files in /dev have are type device with major/minor value. that's this pair that describes the role of the file (not always). kernel.org/doc/Documentation/admin-guide/devices.txt
    – A.B
    Commented Nov 16, 2019 at 18:00

1 Answer 1


Your tldp links are a bit historic. And if you look at /dev just as part of the filesystem, you miss the essence of this subsystem.

A.B's comment mentions major/minor; but his link is just the raw list. Here allocated devices kernel.org HTML there are some additional infos.

I think "everything is a file" is rather misleading in this context. The files in /dev are so called special files, either character or block. The "c" or "b" show this.

]# ls -l /dev/tty1 /dev/sda1 
brw-rw---- 1 root disk 8, 1 Nov  5 17:27 /dev/sda1
crw------- 1 root tty  4, 1 Nov  7 05:48 /dev/tty1

And the docs have for major=8:

   8 block      SCSI disk devices (0-15)
                  0 = /dev/sda          First SCSI disk whole disk
                 16 = /dev/sdb          Second SCSI disk whole disk
                 32 = /dev/sdc          Third SCSI disk whole disk
                240 = /dev/sdp          Sixteenth SCSI disk whole disk

But this does not even directly explain why a partition with a high number suddenly gets major=259:

]# ls -l  /dev/sda16
brw-rw---- 1 root disk 259, 0 Nov  5 17:27 /dev/sda16

I pick this "sda" example because it is the primary mass storage. I don't know how this translates to Android.

Block devices (partitions) can be written to directly, but normally they are formatted with a filesystem and then mounted.

In general, the files in /dev are the interface to the device, not the device itself.

Today, /dev is a pseudo-filesystem like /sys:

/dev      dev        devtmpfs
/sys      sys        sysfs
/         /dev/sda3  ext4

During boot, /dev gets populated by the kernel. A user can add devices by loading modules. modprobe loop gives you /dev/loop0-7 e.g.

(A suggested edit wants populated "by udev" instead of "by the kernel". I think this is more the naming than populating per se. If you want to go into the details, you rather have to look at the drivers, modules or not.)

By plugging in an external usb storage, you get sdb, sdc etc., but only if the usb_storage module is loaded.

The interface nature of /dev special files also shows in the names: some like sda or tty are technical, some (under /dev/disk/by-...) are links for convenience or identification.

You must log in to answer this question.

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