Unix File Types - Device File

Device File

In Unix almost all things are handled as files and have a location in the file system — even hardware devices like hard drives. The great exception for devices and the files that represent them are network devices that do not turn up in the file system but are handled separately.

Device files are used to apply access rights and to direct operations on the files to the appropriate device drivers.

Unix makes a distinction between character devices and block devices. The distinction is roughly as follows:

  • character devices provide only a serial stream of input or output;
  • block devices are randomly accessible;

although, for example, disk partitions may have both character devices that provide unbuffered random access to blocks on the partition and block devices that provide buffered random access to blocks on the partition.

A character device is marked with a c as the first letter of the mode string. Likewise, a block device is marked with a b, e.g.

crw------- ... /dev/null brw-rw---- ... /dev/sda

Read more about this topic:  Unix File Types

Famous quotes containing the words device and/or file:

    A bracelet of bright hair about the bone,
    Will he not let us alone,
    And think that there a loving couple lies
    Who thought that this device might be some way
    To make their souls, at the last busy day,
    Meet at this grave, and make a little stay?
    John Donne (1572–1631)

    Probably nothing in the experience of the rank and file of workers causes more bitterness and envy than the realization which comes sooner or later to many of them that they are “stuck” and can go no further.
    Mary Barnett Gilson (1877–?)