Regular files have an end-of-file (EOF) marker, while device files do not.
Think about it—when does a serial port terminate?—Only when the driver is unloaded does the serial port terminate.
That explanation might still be a bit unclear, so let’s look at a direct example.
First, let’s talk about the cat command.
The cat command reads in a loop until it encounters the end-of-file (EOF) marker. However, when you cat a device file, you’ll notice that the device file’s content just keeps being read indefinitely.
For example:
But when I executed cat /dev/hello, this is what happened:
Notice the ^C above.
This demonstrates that device files do not have an EOF (end-of-file) marker.