On Thu, Nov 02, 2023 at 12:16:54PM -0500, John Hasler wrote: > This was in the 1970s when the graphical UI was being invented. The > idea was that the screen was to look like an actual desktop which might > have actual file folders on it. Every icon was supposed to be an image > of a familiar office object. In that context a directory is a phone > book.
The use of "directory" in the Unix sense predates graphical UI development. It's called a directory because that's how it works, and how it looks when you examine it at a low level. In traditional Unix systems, you could cat a directory and see the actual bytes that it's made of. (Linux prohibits this.) If you did, you might see something like: README.txt 4567 foo.c 198 foo.o 211 where the spaces are actually NUL bytes, and the digits are actually binary two-byte integers. Those are filenames and inode numbers. That's literally what a directory was -- a table of filenames and inode numbers. Modern file systems are a little bit fancier, but the directory concept is still very similar. You've got filenames and inode numbers, in a list. It's a phone book for files. Filenames were limited to 14 bytes on these systems, because each directory entry was a 16-byte data structure, with 14 bytes for the filename, and 2 bytes for the inode number. There may still be some file systems in use with the 14-byte filename restriction, but they're dying out. Calling these things "folders" discards all of this history and knowledge. But the real problem with calling them "folders" is that it doesn't match the Unix user interface. The command to make one is mkdir(1), not mkfolder. To remove one, rmdir(1). When you use "ls -l", a directory is indicated by the letter "d", not "f". When you want find(1) to act upon directories, you use "-type d". The "-type f" option is for regular files, not folders. In C, you change directory by calling chdir(2). In a shell, it's "cd".