Linux Directories and Links: Complete System Programming Guide
Linux Directories and Links: Complete System Programming Guide
About This Chapter
Chapter 18 of “The Linux Programming Interface” covers the internals of Linux directories, hard links, symbolic links, and the system calls for managing them. This guide breaks it down into 8 focused topics with simple language, inline diagrams, real code examples, and interview questions — perfect for students and embedded engineers.
Topics Covered
All Topics
What is an inode, what it stores, how directories map names to inodes, hard link creation and deletion, link count.
What symlinks are, how they differ from hard links, dangling links, symlink chains, which syscalls follow them.
Creating hard links with link(), removing them with unlink(), when files are truly deleted, the anonymous temp file trick.
Renaming and moving files, creating directories, removing directories, atomic file updates with rename().
opendir(), readdir(), closedir(), rewinddir(), struct dirent, d_type, fdopendir(), readdir_r().
Recursively walking a directory tree, preorder vs postorder, flags, recursive deletion, find-like searches.
getcwd(), chdir(), fchdir() for save/restore, openat() for thread-safe file ops, chroot() jails.
Creating symlinks, reading symlink contents, resolving canonical paths, splitting pathnames into parts.
Start Learning
Begin with Part 1 and work through each topic in order.
