Fundamentals 37 min read

Understanding Linux: Kernel, Shell, Filesystem, and Process Management

This comprehensive guide explains Linux's core components—including the kernel, shell, memory and process management, virtual file system, device drivers, networking, and mounting—while detailing filesystem types, directory structures, link types, and practical commands for managing partitions and mounts.

Efficient Ops
Efficient Ops
Efficient Ops
Understanding Linux: Kernel, Shell, Filesystem, and Process Management

Linux systems generally consist of four main parts: the kernel, the shell, the file system, and applications. The kernel, shell, and file system together form the fundamental operating system structure, allowing users to run programs, manage files, and interact with the system.

Linux Kernel

The kernel is the core of the operating system, providing essential functions such as process, memory, device driver, file, and network management, which directly affect system performance and stability.

The Linux kernel is composed of memory management, process management, device drivers, file system, and network management modules.

System call interface (SCI) offers mechanisms for user‑space to kernel‑space function calls; its implementation can be found in ./linux/kernel and architecture‑specific parts in ./linux/arch.

Memory Management

Because physical memory is limited, Linux uses virtual memory, dividing memory into manageable pages (typically 4 KB). It provides mechanisms such as the SLAB allocator to track page usage and dynamically adjust memory allocation.

When memory is exhausted, pages can be swapped out to disk. The source code for memory management resides in ./linux/mm.

Process Management

A process is an executing instance of a program. Linux achieves multitasking by rapidly switching between processes, each receiving a time slice. The scheduler selects the next process based on priority.

Processes have isolated address spaces and communicate via signals, pipes, shared memory, semaphores, and sockets. System calls like fork, exec, kill, and exit are provided through the SCI API.

File System

Unlike DOS/Windows, Linux does not use drive letters; instead, it presents a unified hierarchical tree where each file system is mounted at a directory. The most common native file system is Ext2, but Linux also supports FAT, VFAT, FAT32, MINIX, and many others.

The Virtual File System (VFS) abstracts hardware details, offering a uniform API for file operations across diverse file systems. VFS sits between the system call interface and concrete file system implementations.

Below VFS are the file system implementations (over 50 types), followed by the buffer cache, and finally the device drivers that interact with hardware.

Device Drivers

Device drivers run in privileged mode and directly control hardware. Errors in drivers can crash the system. Drivers expose abstract interfaces to the kernel while handling hardware‑specific details.

Network Interface (NET)

Linux supports a full TCP/IP stack and BSD sockets. Network drivers communicate with hardware, and the network stack processes protocols and routing.

Linux Shell

The shell is the user interface that interprets commands and passes them to the kernel. Common shells include Bourne Shell, Bash (the default on most distributions), Korn Shell, and C Shell.

File Types

Regular files (text, binaries, scripts)

Directory files

Link files (hard and symbolic)

Device files (block and character devices under /dev)

FIFO (named pipe) files

Socket files (network communication)

Commands such as ls -l, file, and stat display file type information.

Directory Structure

Linux uses a single root directory ( /) with a hierarchical tree beneath it. Important top‑level directories include /bin, /dev, /etc, /home, /lib, /sbin, /tmp, /root, /mnt, /proc, /var, and /usr (which contains subdirectories such as /usr/bin, /usr/lib, /usr/include, etc.).

Disk Partitions

Linux distinguishes primary, extended, and logical partitions. Devices are identified as /dev/hdX or /dev/sdX (e.g., /dev/sda1 for the first partition on the first SCSI/SATA disk).

fdisk -l</code><code>Disk /dev/hda: 80.0 GB, 80026361856 bytes</code><code>255 heads, 63 sectors/track, 9729 cylinders</code><code>Units = cylinders of 16065 * 512 = 8225280 bytes</code><code>Device Boot Start End Blocks Id System</code><code>/dev/hda1 * 1 970 7791493+ 7 HPFS/NTFS</code><code>/dev/hda2 971 9729 70356667+ 5 Extended</code><code>/dev/hda5 971 2915 15623181 b W95 FAT32</code><code>/dev/hda6 2916 4131 9767488+ 83 linux</code><code>/dev/hda7 4132 5590 11719386 83 linux</code><code>/dev/hda8 5591 6806 9767488+ 83 linux</code><code>/dev/hda9 6807 9657 22900626 83 linux</code><code>/dev/hda10 9658 9729 578308+ 82 linux swap / Solaris

Each partition must be mounted to a directory to become accessible.

Mounting File Systems

Mounting attaches a file system's root directory to a mount point in the existing directory tree. The mount command syntax is mount [-options] [device] [mount_point]. Common options include -t to specify the file system type and -o for additional flags such as ro, rw, user, etc. # mount -t vfat /dev/hda5 /mnt/winc To mount a CD-ROM: # mount -t iso9660 /dev/cdrom /mnt/cdrom VirtualBox shared folders can be mounted with: # sudo mount -t vboxsf myshare /media/share Automatic mounting at boot is configured in /etc/fstab. Example entries:

/dev/hda2 / ext3 defaults 1 1</code><code>/dev/hda1 /boot ext3 defaults 1 2</code><code>none /dev/pts devpts gid=5,mode=620 0 0</code><code>none /proc proc defaults 0 0</code><code>none /dev/shm tmpfs defaults 0 0</code><code>/dev/hda3 swap swap defaults 0 0</code><code>/dev/cdrom /mnt/cdrom iso9660 noauto,codepage=936,iocharset=gb2312 0 0</code><code>/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0</code><code>/dev/hdb1 /mnt/winc vfat defaults,codepage=936,iocharset=cp936 0 0</code><code>/dev/hda5 /mnt/wind vfat defaults,codepage=936,iocharset=cp936 0 0

Hard and Symbolic Links

Hard links point to the same inode as the original file; they cannot cross file system boundaries. Symbolic (soft) links contain the pathname of the target file and behave like shortcuts.

Removing the original file invalidates a symbolic link but leaves hard links intact.

VFS Internals

In the kernel, each opened file is represented by a struct file containing flags, position, and a pointer to struct file_operations. The file descriptor table in the process control block indexes these structures.

Each file points to a dentry (directory entry), which in turn points to an inode. The inode links to inode_operations and a super_block that describes the file system type and parameters.

File System Types

Ext2, Ext3 (native Linux)

RAMFS (in‑memory)

NFS (network)

FAT, VFAT, FAT32 (Windows)

NTFS (Windows NT/XP)

ISO9660 (optical media)

Various others such as XFS, JFS, ReiserFS, etc.

Linux can mount many foreign file systems, though permissions may be mapped to generic rwxrwxrwx when the underlying system lacks Unix‑style attributes.

File System Layout

A file system consists of a superblock (global metadata), an inode table (metadata for each file), and data blocks (actual file contents). The superblock is analogous to a book’s cover, inodes to the table of contents, and data blocks to the chapters.

Indexed allocation (used by Ext2/3) allows the kernel to read all blocks of a file in one operation, whereas FAT uses linked allocation, requiring sequential reads and leading to fragmentation.

Fragmentation is less of a concern for indexed file systems, but long‑term heavy file churn may still warrant occasional defragmentation.

Linux Applications

Typical Linux distributions include text editors, programming languages, X Window System, office suites, internet tools, and databases.

Linux Kernel Parameter Optimization

Kernel parameters expose a runtime interface via the /proc filesystem, allowing administrators to tune performance without rebooting.

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.

Kernelprocess managementLinuxOperating SystemShellFilesystem
Efficient Ops
Written by

Efficient Ops

This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.

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.