How are devices represented in UNIX?

As far as I understand it, everything is treated as a file in Unix and Linux. Even devices and running processes.

Typically, the file-system entries for all connected hardware/devices can be found in the /dev directory (and its sub-directories). If you open up a terminal and cd to /dev and then use ls -a -l , you can see which files refer to which devices.

There are two types of devices, block and char. Block devices tend to be things like RAM and hard-drives and char devices are pretty much anything else.

I don't know much more than that myself atm, so I can't really elaborate further, but I hope this helps!

commented: Accurate and short. +8

Devices are represented in the file system under the /dev directory.

All devices wil ble listed in cd /dev/

ls -l will show you all the devices

How are devices represented in UNIX?

These are called block devices and their location are /dev/...

All devices, be they block devices (disc drives etc), character devices (serial devices, modems), or other (network ports, memory, etc) are all represented as special files in /dev/. For example, the "bit bucket" where you can put a command's output that you aren't interested in is /dev/null. If you want to erase a disc, you can read from /dev/zero and write to the physical device. For example, you have a thumb drive that you plug into the system (unmounted) that is registered as /dev/sdx. Then you can wipe the device with the command: dd if=/dev/zero of=/dev/sdx


Devices in UNIX are represented by files. These are special files located in the dev directory.