Learning directory and path operations
The kernel in Linux (and other Unix variants) maintains a single directory tree structure visible to a process, which is hierarchical and contains all files in that namespace. This hierarchical organization contains both individual files, directories, and links (for example, a symbolic link).
In the previous section, we looked at files and file operations in Rust. In this section, we will take a closer look at directory and path operations. In the next section, we will cover links.
A directory is a special file that contains a list of filenames with references (inodes) to the corresponding files. Directories can point to regular files or other directories. It is this connection between directories that establishes the overall directory hierarchy in a namespace. For example, /
represents the root directory, and /home
and /etc
will link to /
as the parent directory. (Note that in some operating systems, such as Microsoft Windows variants,...