Lecture 10 Linux File System
LINUX FILE SYSTEM
One essential part of the operating system is the Linux file system.
It offers a hierarchical data management and organization system.
Root Directory
The root directory ("/") as the initial directory.
a subdirectory and directory hierarchy.
Files and subdirectories are found in directories.
Data management
maintains metadata, sizes, creation dates, and file names.
in charge of ownership, security, and permits.
Representation and Organization of Storage Resources
Allocates disk space for files and directories.
Maintains directory structure.
Stores metadata for each file.
Pathnames
Textual file or directory locations.
Absolute (from the root) or relative (from the current directory).
Example of Absolute and Relative Path in Directory Navigation:
Current Directory: You are currently located in "/home/kt."
Objective: You want to change your directory to "/home/kt/abc."
Using the Relative Path Concept:
Check the current directory:
Command: $pwd
Output: /home/kt
Change directory using a relative path:
Command: $cd abc
Confirm the new directory:
Command: $pwd
Output: /home/kt/abc
Using the Absolute Path Approach:
Verify your current location:
Command: $pwd
Result: /home/kt
Change the directory using an absolute path:
Command: $cd /home/kt/abc
Confirm the new directory:
Command: $pwd
Result: /home/kt/abc
Unified Hierarchy
Single, root-to-subdirectory file structure.
Root Directory ("/")
The top-level directory, starting point.
File Organization
Files (data, programs) and directories (nesting).
Hierarchical Structure
Tree-like structure for organization.
Management
Pathnames for file/directory navigation.
Basic commands: "cd," "ls," "cp," "mv."
Access Control
Permissions for file and directory security.
File types in Linux
In the Linux system, the fundamental principle is that everything can be treated as a file or a process.
Most file system implementations categorize files into seven main types. Even if new elements are introduced into the file structure, such as process information located in "/", they must still conform to one of these seven types:
- Regular files
- Directories
- Character device files
- Block device files
- Local domain sockets
- Named pipes (FIFO)
- Link files
The structure and categorization of these file types remain consistent, even when new additions are made to the system.
1. Regular (Ordinary) Files in Linux
Definition: Regular or ordinary files are used to store various types of data, including text, audio, video, images, scripts, and programs.
Commonality: The majority of files on UNIX and Linux systems are regular files.
File Types: Regular files can store a wide range of content, making them one of the most versatile file types in Linux.
Extensions: In Linux, regular files can be created both with and without file extensions. The presence of extensions can provide information about the file type, but they are not mandatory.
Naming Convention: Regular files start with -
2. Directories in the Linux File System
Definition: A directory is a file that stores named references to other files. It's used to organize and locate files and directories.
Binary File: Directories are binary files containing information about the files and subdirectories they reference.
Creation and Deletion: Directories can be created using the "mkdir" command and deleted using "rmdir" if they are empty.
Hierarchy Organization: To structure files in a hierarchical manner, file systems rely on directories.
Root Directory: The Linux file system starts with a root directory ("/"), which serves as the top-level directory. All files and directories are created under this root directory.
Parent-Child Relationships: With the exception of the root directory, each directory has a parent directory, forming a parent-child relationship between directories.
3. Special Files: Character device & Block device file
Special File Concept: In Linux, all hardware devices, including hard drives, printers, monitors, terminal emulators, and CD/DVD drives, are treated as special files.
Exposing Hardware as Files: The purpose of a special file is to represent a hardware device as if it were a file in the file system. This abstraction simplifies device access.
Universal Interface: Special files create a universal interface for both hardware devices and virtual devices managed by the kernel. This allows tools for file input/output (I/O) to interact with the device.
Immediate Data Transfer: When data is read from or written to a special file, the operation occurs immediately and is not subject to the usual rules and restrictions of a conventional file system. This allows direct interaction with the underlying hardware.
Comments
Post a Comment