Fundamentals 6 min read

Understanding Linux Filesystems: Inodes, Directory Structure, and Links

This guide explains Linux's unified file concept, the hierarchical directory layout, the role of inodes in mapping logical to physical storage, and the differences between hard and soft links, providing clear examples and visual diagrams for each topic.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Understanding Linux Filesystems: Inodes, Directory Structure, and Links

1. Introduction

Linux treats disks, directories, and files as unified resources, following the Unix philosophy that everything is a file.

2. Linux Filesystem

All system resources—including network interfaces, storage devices, printers, and regular files—are represented as files. Linux supports five basic file types, illustrated below.

Linux file types
Linux file types

3. Directory Structure

The Linux filesystem is a tree rooted at /. Common top‑level directories include: /bin – essential user binaries /sbin – system binaries /etc – configuration files /usr – secondary hierarchy for user programs and data /var – variable data such as logs /home – user home directories

The structure is visualized in the following diagram.

Linux directory hierarchy
Linux directory hierarchy

4. What Is an Inode?

An inode (index node) stores a file’s metadata—owner, permissions, timestamps, size, and pointers to data blocks. Disks are divided into 512‑byte sectors; groups of sectors form a block (commonly 4 KB). The inode is a 64‑byte table containing, among other fields, a disk address table with 13 block pointers that map the file’s logical layout to its physical blocks.

When a file is accessed, the filesystem looks up the filename in the current directory, retrieves the associated inode number, and then follows the inode’s address table to read the file’s data blocks.

5. Hard Links and Soft (Symbolic) Links

Both link types provide alternative paths to a file, but they differ in implementation and constraints.

Hard link: Creates an additional directory entry that points directly to the same inode. The link count of the inode increases. Hard links cannot span different filesystems, and only the superuser may create hard links to directories.

Soft link (symbolic link): A special file that contains the pathname of the target file. It has its own inode and can point to files on different filesystems or even remote machines. However, if the target is moved or deleted, the symlink becomes dangling.

In practice, soft links are preferred for their flexibility, while hard links are limited to the same filesystem and cannot reference directories without elevated privileges.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

linuxinodeFilesystemHard Linksoft linkdirectory
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.