A correction: the directory is a list of fileNAME-inode pairs. And it's not an "ordinary" file. Like symlinks, sockets, and device nodes, its behaviour is different from that of ordinary files.
From the shell, you can see the mapping with
From C, the structure returned by
readdir() contains a
d_name and a
d_ino element, from which you can also see this mapping.
From userspace, the fact that a directory maps filenames to inodes is not usually all that important, because the kernel requires that you designate files by their name anyway. It doesn't let you ask for a file by inode number.
Symbolic links are another example of a type of file which contains information that can't be read as though it were a byte stream with systems calls like
read(). Like an ordinary file, it contains data. In this case the data has special meaning: it's a pathname (which is a string) naming the target of the symlink. Unlike an ordinary file, the contents are not written using
write() but with
symlink(), and the contents are not read using
read() but with