Linux Tutorial Series

Linux Tutorial Series – 143 – Device files

Here is the video version, if you prefer it:

Device files are files that are actually device I/O (input/output) interfaces. (Ward, 2014)⁠ If you take the trip back down the memory lane, when I was explaining what each Linux directory is for, I said that /dev contains files which represent devices. They are located in the /dev folder. They can also be called device nodes.

Let’s see what I get with ls -l when I go to /dev:

mislav@mislavovo-racunalo:/dev$ ls -l

total 0

crw-r--r-- 1 root root 10, 235 Jan 2 18:11 autofs

drwxr-xr-x 2 root root 280 Feb 12 07:48 block

drwxr-xr-x 2 root root 60 Feb 12 07:48 bsg

crw-rw---- 1 root disk 10, 234 Feb 11 16:19 btrfs-control

drwxr-xr-x 3 root root 60 Nov 9 17:37 bus

drwxr-xr-x 2 root root 3520 Feb 12 07:48 char

crw------- 1 root root 5, 1 Jan 2 18:11 console

A bunch of files representing devices.

There is a special “device” called /dev/null, which doesn’t represent any device, but rather, it represents “void”. If you send any data to it, as in:

mislav@mislavovo-racunalo:/dev$ ls -l > /dev/null

nothing happens. More specifically, the kernel ignores the information sent to /dev/null.

One important thing to note is that not all devices are represented with device files.

Hope you learned something new!


Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Page 46