0% found this document useful (0 votes)
57 views

Linux File System

Uploaded by

ravi_kishore21
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Linux File System

Uploaded by

ravi_kishore21
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DevOps Shack

Detailed Explanation of the Linux File System


Click Here To Enrol To Batch-6 | DevOps & Cloud DevOps
The Linux file system is a hierarchical structure that organizes and manages files on a Linux
operating system. It consists of directories, subdirectories, and files, structured in a tree-like
format starting from the root directory. Here's a detailed look at the components and
structure of the Linux file system.
File System Hierarchy
Root Directory (/)
The root directory is the top-most directory in the Linux file system hierarchy. All other
directories and files are placed under the root directory.
Key Directories and Their Functions
/bin
Contains essential command binaries that are needed for the system to boot and run in
single-user mode. Commands like ls, cp, and mv are located here.
/boot
Contains the boot loader files, including the Linux kernel and other files needed to boot the
operating system.
/dev
Contains device files, which are special files that represent devices. For example, /dev/sda
represents a hard drive.
/etc
Contains configuration files and scripts that are used by system administrators and services.
Examples include /etc/passwd for user account information and /etc/fstab for file system
mount points.
/home
Contains the home directories for users. Each user has a subdirectory within /home, such as
/home/user1 and /home/user2.
/lib
Contains shared libraries needed by the binaries in /bin and /sbin, and kernel modules.
/media
Contains mount points for removable media such as USB drives and CD-ROMs.
/mnt
Used for temporarily mounting file systems.
/opt
Contains optional software and add-on packages that are not part of the default installation.
/proc
Contains virtual files that represent system and process information. It provides a
mechanism for the kernel to send information to processes.
/root
The home directory for the root user.
/run
Contains runtime data for processes since the system was booted.
/sbin
Contains essential system binaries that are used for system administration, such as ifconfig
and iptables.
/srv
Contains data for services provided by the system, such as web and FTP servers.
/sys
Contains virtual files that represent the system and kernel information. It's similar to /proc
but provides different kinds of information.
/tmp
Contains temporary files that are created by applications and the system.
/usr
Contains user utilities and applications. It is further divided into subdirectories like:
• /usr/bin: Contains binaries for user applications.
• /usr/sbin: Contains system administration binaries.
• /usr/lib: Contains libraries for binaries in /usr/bin and /usr/sbin.
• /usr/local: Contains user programs that are installed locally.
/var
Contains variable data files. This includes logs, spool files, and temporary files created by
applications.

Linux File System Types


Linux supports multiple file system types, each with its own characteristics and use cases.
Ext2, Ext3, Ext4
The Ext (Extended File System) family is the default file system for most Linux distributions.
Ext4 is the most recent and widely used, offering features like journaling, large file support,
and extended attributes.
XFS
A high-performance file system designed for large files and high scalability. It is often used
for large-scale data storage.
Btrfs
A modern file system offering advanced features like snapshotting, RAID support, and
efficient storage management.
ZFS
Originally developed by Sun Microsystems, ZFS is known for its robustness, data integrity,
and scalability. It includes features like snapshots, copy-on-write clones, and built-in RAID.
NTFS, FAT, exFAT
These file systems are commonly used in Windows environments. Linux can read and write
to these file systems, which is useful for sharing data between Linux and Windows.
Key Concepts and Features
Inodes
Inodes are data structures that store information about files and directories, such as file
ownership, permissions, and metadata. Each file or directory has a unique inode.
Mounting
Mounting is the process of making a file system accessible at a certain point in the directory
tree. For example, mounting a USB drive at /mnt/usb allows you to access its contents under
that directory.
Permissions
Linux uses a permission model to control access to files and directories. Each file has
permissions for the owner, group, and others, defined for reading, writing, and executing.

Links
Links are pointers to files. There are two types:
• Hard Links: Direct pointers to the inode of a file. Multiple hard links to the same
inode are indistinguishable from the original file.
• Symbolic Links (Symlinks): Pointers to the file name. If the target file is deleted, the
symlink becomes broken.
Example Commands
List Files and Directories
ls -l

Display Disk Usage


df -h

Mount a File System


sudo mount /dev/sdb1 /mnt/usb

Change File Permissions


chmod 755 filename

Create a Symbolic Link


ln -s /path/to/target /path/to/link

Textual Diagram of Linux File System


Conclusion
The Linux file system is designed to be flexible, efficient, and secure. Its hierarchical
structure, combined with various file system types and advanced features like inodes and
permissions, makes it suitable for a wide range of use cases, from personal computing to
enterprise-level deployments. Understanding the structure and functionality of the Linux file
system is crucial for effective system administration and usage.

You might also like