Chapter 5. Everything’s a File

This is the third and final file-related chapter. In it, we reveal one of the kernel’s deepest, darkest secrets.

We’ve already looked at a few file-related commands, gone over how files—in general—are organized on your system, and learned how find a file when we need it.

You’re ready for the big secret, so here it is: through the eyes of the Linux kernel, everything is a file.

Devices like modems, monitors, CD-ROMS, hard drives, even keyboards and printers are files. You (what you type on the keyboard, at least) are a file, the data that appears on your screen in response to what you’ve typed is a file, even any error messages that might result from what you’ve typed is a file.

In fact, those last three files form something ...

Get CLI for Noobies: A Primer on the Linux Command Line now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.