Way back at the beginning I said that Linux® treats everything as a file. Everything! That includes devices, like the network interface, the wireless interface, the USB port, the motherboard, the sound board, speakers, microphones, you get the idea. Every device you could add to your computer is treated like a file.
We can’t have those files floating around willy nilly, can we? That’d be very confusing very quickly. Sort of like asking the Hulk to keep track of Hawkeye’s arrows. it would go really badly.
Instead, Linux® keeps all those files in one place, known as the /dev directory. Every device has a file in this directory that Linux® uses to communicate with it.
If I do ls -l on /dev I get 676 lines. I know because I did this:
Alpha:~ computerlamp$ ls -l /dev | wc -l 676
That doesn’t mean there are 676 devices on my system! I’d have one busy system if that was the case. It means that there are the possibilities for that many devices.
Let’s look at some of the output from ls -l:
Alpha:~ computerlamp$ ls -l /dev/ crw------- 1 root root 10, 235 Aug 11 02:19 autofs crw------- 1 root root 5, 1 Aug 11 02:19 console lrwxrwxrwx 1 root root 11 Aug 11 02:19 core -> /proc/kcore crw------- 1 root root 10, 58 Aug 11 02:19 cpu_dma_latency drwxr-xr-x 3 root root 60 Aug 11 02:19 disk crw------- 1 root root 10, 63 Aug 11 02:19 dlm-control crw------- 1 root root 10, 62 Aug 11 02:19 dlm-monitor crw------- 1 root root 10, 61 Aug 11 02:19 dlm_plock crw------- 1 root root 10, 60 Aug 11 02:19 ecryptfs lrwxrwxrwx 1 root root 13 Aug 11 02:19 fd -> /proc/self/fd crw-rw-rw- 1 root root 1, 7 Aug 11 02:19 full crw------- 1 root root 10, 229 Aug 11 02:19 fuse
That isn’t very helpful, is it. I don’t know what dlm means and why there’s a dlm-control or a dlm-monitor I’m going to guess that the disk directory has something to do with hard drives, but I’m not sure. encryptfs looks interesting, I bet it has something to do with encrypting things, but I’m not sure of that either.
The other thing to pay attention to is that the ownership and permissions of a lot of the files in this directory are restricted to root. That means that while I can use ls -l to see that they’re there, I can’t actually look at them.