Agenda

<aside> 📌 Reminders

🔺 Directories

A directory is a special type of file that acts as a container for other files and subdirectories, forming the hierarchical structure of the filesystem.

Just like regular files, directories are represented internally with iNodes (with the usual metadata), but, unlike regular files, directories don’t store content in their data blocks. Instead, they function as lookup tables that map filenames to their corresponding inodes. When you list the contents of a directory (ls), the system retrieves the filenames stored in that directory and then uses the inode numbers to access metadata and file locations.

Source: https://unix.stackexchange.com/questions/325294/how-does-a-directory-inode-keep-its-file-list

Source: https://unix.stackexchange.com/questions/325294/how-does-a-directory-inode-keep-its-file-list

So, adding or removing a file to/from a directory amounts to just writing or erasing an entry in its corresponding data block.

Key Characteristics of Directories:

image.png

🛣️ File paths

Paths to files/directories can be relative or absolute.

The absolute path

The absolute path /foo/foo.txt

The relative path  ; relative to the root directory

The relative path foo/foo.txt ; relative to the root directory

Special Notation for Relative Paths: