Device

From Hackepedia
Jump to navigationJump to search

Devices are found in the /dev directory. There are several types of devices:

  • block devices -- A.K.A "cooked" devices. Data stored on the device is typically accessed in groups, instead of one byte at a time. Hard drives, tape systems, and other mass-storage devices are almost always block devices. Data is more or less random-access (although performance may suffer greatly, as in the case of a tape).
  • character devices -- Data is usually managed in a stream. Serial, audio, and most other non-storage devices fall into this category.
  • sockets -- File-like interfaces to network resources that open a port
  • pipes -- A "named pipe." See FIFO


# ls -la /dev/
[snip]
brw-rw----  1 root disk      1,   9 2005-12-27 14:14 ram9
crw-rw-rw-  1 root root      1,   8 2005-12-27 14:14 random
[snip]

You can see the b and c for block vs character. You can use mknod to create a block or charcter device.