Directories are actually files

Files and directories look like two different things. Here's a surprising fact.
In the Unix world, a directory is treated as a special kind of file, one that contains a list of the files inside it. In other words, even the folders you see with ls are files under the hood. A file that holds the names of other files: it's a wonderfully recursive concept.
This comes from Unix's design philosophy: "Everything is a file". Files, directories, even keyboard input: everything is treated uniformly as a file. Thanks to this elegant simplification, Unix commands stay simple and composable. The fact that a design philosophy from over 50 years ago is still alive today speaks to just how beautiful it is.
