0% found this document useful (0 votes)
15 views6 pages

The Story of Linux and Its Files

Linux treats everything as a file, simplifying data and system component management. It categorizes files into regular files, directories, symbolic links, and device files, with each file linked to an inode storing metadata. The Filesystem Hierarchy Standard (FHS) organizes files and directories, ensuring data integrity and ease of access.

Uploaded by

Stephen Efange
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views6 pages

The Story of Linux and Its Files

Linux treats everything as a file, simplifying data and system component management. It categorizes files into regular files, directories, symbolic links, and device files, with each file linked to an inode storing metadata. The Filesystem Hierarchy Standard (FHS) organizes files and directories, ensuring data integrity and ease of access.

Uploaded by

Stephen Efange
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

The Story of Linux and Its Files

Users and Files: The Beginning


Users create files, and Linux sees everything as a file. Whether it is a document, a directory, a
device, or even a network socket, it is all represented as a file. This foundational principle
simplifies the way Linux handles data and system components.

Types of Files in Linux


Linux classifies files into different categories:

1. Regular (Ordinary) Files – These include text files, scripts, executables, and logs.
2. Directories – Special files that store references to other files.
3. Symbolic (Soft) Links – Pointers to other files, similar to shortcuts.
4. Device Files – Represent hardware components like disks, printers, and terminals.

Directories and Inodes


A directory in Linux is simply a special file that contains pointers to other files. Each file is
linked to an inode (index node), which stores metadata about the file, such as its size,
permissions, ownership, and timestamps. The inode does not store the filename but holds the
location of the data on disk.

File Permissions and Management


Since files store essential data, they require proper permissions to maintain security. Linux uses
a three-tier permission system:

 Owner (User) – The creator of the file.


 Group – A set of users who share access to the file.
 Others – Any other users on the system.

Each file has read (r), write (w), and execute (x) permissions, which can be viewed using:

ls -l

And modified using:

chmod 755 myfile

Where Are Files Stored? Understanding FHS


To maintain order, Linux follows the Filesystem Hierarchy Standard (FHS), which defines
how files and directories should be structured:

Directory Purpose
/bin Essential system binaries
/etc Configuration files
/home User home directories
/var Log and variable data
/dev Device files
/mnt Mount points for external devices

The Linux Data Storage Hierarchy


Data follows a structured hierarchy:

1. Data is stored in files.


2. Files are organized into a file system.
3. A file system resides on a volume.
4. A volume is created on physical or virtual drives.

This hierarchy ensures data integrity and ease of access. Volumes can be formatted with file
systems like ext4, XFS, or Btrfs to optimize performance and reliability.

Linux's design makes file management intuitive, secure, and efficient. Whether handling system
processes, user data, or network communication, understanding the file system is key to
mastering Linux!

The Story of Linux and Its Files

Users and Files: The Beginning

Users create files, and Linux sees everything as a file. Whether it is a document, a directory, a device, or
even a network socket, it is all represented as a file. This foundational principle simplifies the way Linux
handles data and system components.

Types of Files in Linux

Linux classifies files into different categories:

1. Regular (Ordinary) Files – These include text files, scripts, executables, and logs.

2. Directories – Special files that store references to other files.

3. Symbolic (Soft) Links – Pointers to other files, similar to shortcuts.

4. Device Files – Represent hardware components like disks, printers, and terminals.
To see these types, use the following command:

bash

CopyEdit

ls -alih

Here’s a breakdown of the ls -alih command output:

 -l shows a detailed listing with file types, permissions, and ownership.

 -a includes hidden files (those starting with a dot .).

 -i displays the inode number of each file.

 -h provides human-readable file sizes.

The output will look something like this:

bash

CopyEdit

$ ls -alih

total 52K

1432988 drwxr-xr-x 2 user group 4.0K Mar 15 10:00 dir

1432989 -rw-r--r-- 1 user group 19K Mar 15 09:59 file.txt

1432990 lrwxrwxrwx 1 user group 8 Mar 15 09:59 symlink -> file.txt

1432991 crw-rw-rw- 1 root root 12, 3 Mar 15 09:59 /dev/sda

In the output:

 d before the permissions indicates a directory.

 - before the permissions indicates a regular file.

 l indicates a symbolic link.

 c indicates a character device file.

Directories and Inodes

A directory in Linux is simply a special file that contains pointers to other files. Each file is linked to an
inode (index node), which stores metadata about the file, such as its size, permissions, ownership, and
timestamps. The inode does not store the filename but holds the location of the data on disk.

File Permissions and Management

Since files store essential data, they require proper permissions to maintain security. Linux uses a three-
tier permission system:
1. Owner (User) – The creator of the file.

2. Group – A set of users who share access to the file.

3. Others – Any other users on the system.

Each file has read (r), write (w), and execute (x) permissions, which can be viewed using:

bash

CopyEdit

ls -l

And modified using:

bash

CopyEdit

chmod 755 myfile

In the chmod example:

 7 (Owner) represents read, write, and execute permissions (4+2+1).

 5 (Group) represents read and execute permissions (4+1).

 5 (Others) also represents read and execute permissions (4+1).

Understanding Permissions with the 421 Model

Linux permissions are often explained using a numeric model (421). The numbers represent the
permissions for read (4), write (2), and execute (1), which can be combined to form different permission
sets for each user category.

Here’s a table explaining the numeric permission model:

Number Permission Description

7 rwx Read, Write, Execute

6 rw- Read, Write

5 r-x Read, Execute

4 r-- Read only

3 wx- Write, Execute

2 w-- Write only

1 x-- Execute only

0 --- No permissions
Number Permission Description

For example, to give the file myfile read, write, and execute permissions for the owner, and read and
execute permissions for the group and others, you would run:

bash

CopyEdit

chmod 755 myfile

Where:

 7 is for the owner (read, write, execute),

 5 is for the group (read, execute),

 5 is for others (read, execute).

Where Are Files Stored? Understanding FHS

To maintain order, Linux follows the Filesystem Hierarchy Standard (FHS), which defines how files and
directories should be structured:

Directory Purpose

/bin Essential system binaries

/etc Configuration files

/home User home directories

/var Log and variable data

/dev Device files

/mnt Mount points for external devices

The Linux Data Storage Hierarchy

Data follows a structured hierarchy:

1. Data is stored in files.

2. Files are organized into a file system.

3. A file system resides on a volume.

4. A volume is created on physical or virtual drives.

This hierarchy ensures data integrity and ease of access. Volumes can be formatted with file systems like
ext4, XFS, or Btrfs to optimize performance and reliability.
Linux's design makes file management intuitive, secure, and efficient. Whether handling system
processes, user data, or network communication, understanding the file system is key to mastering
Linux!

You might also like