That's because in Linux
everything is treated as a file
Linux doesn't really deal with file objects and directory objects, it just deals with different types of file object.
'Directories' are actually nothing more than a file that points to other files.