I read in The Design of the UNIX Operating System that directories are files containing the names of each file they contain. So I tried cat
ing one on my Mac, and it resulted in an error: cat: ./: Is a directory
But I then tested it in System 7 UNIX, and it worked.
Why does this not work in modern operating systems? Is a directory no longer a file, or did someone decide we shouldn't be able to read them?
cat
doesn't only output text files. It can be used, for example, to merge binary files. I don't believe it's not up to the program to decide what makes sense. – Josh Williams Mar 30 '16 at 15:25inodes
and can be hard linked to file names these days either – infixed Mar 30 '16 at 15:34