The Linux Filesystem
- A Linux operating system's built-in layer called the Linux file system is typically used to manage storage device data.
- The structure of the Linux file system is tree-like. The directory tree is another name for the structure that resembles a tree.It controls a file's name, size, creation date, and a tonne of other details.
- Representing and organising the system's storage resources is the fundamental function of a filesystem.
- Other files and folders can be found in its root directory.
Pathnames
- A pathname is a text string consisting of one or more names, such as assignment 02 /check, /var/log/auth.log,./etc/passwd, etc., separated by forward slashes (/).
- A pathname is a series of names that tells the hierarchical file system tree where to find a certain item.
- Pathnames that begin with a slash specify locations that are relative to the root of the pathname space (/).
- /home
- /etc/password
- usr /wc
- /vaar/ntpstats loopstats
- The filesystem is shown as a single, cohesive structure that descends via an infinite number of subdirectories from the directory.
- Another name for the root directory is /.
- Under a single tree hierarchical file system structure, Unix/Linux files are arranged into directories that may contain additional subdirectories and files, as well as files that contain data (such as documents and programmes).
File Type in Linux
- Everything in a Linux system is a file, and everything that isn't a file is a process.
- Seven different file types are defined by most file system implementations.
- Developers must still make the file tree appear like one of these seven categories even when they add something amazing and unique, like the process information beneath /.
- Regular files
- Directories
- Character device files
- Block device files
- Local domain sockets
- Named pipes (FIFO)
- Link files
Regular or Ordinary files
Named Pipes:- Text, music, video, photos, scripts, and programmes are just a few of the content kinds that may be stored in regular or ordinary files.
- The vast majority of files on Linux and UNIX are standard files.
- Regular files in Linux can be generated either way around an extension.
- Standard files begin with -
Directories
- Named references to other files can be found within a directory.
- It is a binary file that is used to find and track other directories and files.
- Directories can be created using mkdir and, if they are empty, deleted using rmdir.
- Directories are used by file systems to arrange files in a hierarchy.
- A directory called /, or the root directory, is where the Linux file system begins.
- This directory is where all files and directory files are produced. Every directory, aside from the root directory, has a parent directory.
Special Files: Character device and Block device file
- Hard drives, printers, displays, terminal emulators, and CD/DVD drives are just a few examples of the hardware devices that Linux handles as unique files.
- To expose the device as a file in the file system is the goal of a special file.
- Because tools for file I/O may access the device, a particular file offers a universal interface for physical devices (including virtual devices produced and utilised by the kernel).
- Data written to or read from a special file occurs instantly and is not governed by standard filesystem conventions.
- A character special file is an example of a device, like a printer or monitor, that sends data in bytes. A block special file is an example of a device, like a hard disc, that transmits data in blocks.
- a block-specific special file that grants access to a device that sends data in fixed-size groups. As an instance, a disc.
- a unique character file that grants access to a device—like a terminal—that sends data in single-character increments.
Link files: Hard link And Soft links
- We can utilise a file from a different place and with a different filename thanks to link files. Link files are used for this.
- A pointer to another file is found in a link file. connections come in two varieties: symbolic or soft connections and hard linkages.
- The original file is mirrored when a hard link is used.
- You cannot make a hard link to a file or directory on a different filesystem.#
- By name, a symbolic or "soft" link refers to a specific file.
- It is possible to make a soft link to a file or directory on a different filesystem.
- Applications utilise sockets as communication endpoints to share data.
- For instance, a programme on the local system connects to the socket of a distant application using the port number and IP address of the remote application in order to interact with it.
- Sockets are used by all programmes that accept connections from distant clients or other applications.
- Every socket has a port number and IP address that enable it to receive connections from clients.
- Linux employs socket files to facilitate communication between local programmes.
- Applications running on the local system can communicate data using socket files without requiring the complicated networking and sockets procedure.
- The unique files known as socket files are those that refer to themselves by their file name rather than by their IP address and port number.
- The sendmsg() and recvmsg() system functions are used by socket files to provide inter-process communication between nearby programmes.
- Named pipes facilitate communication between two processes that are operating on the same host, much as local domain sockets.
- Another name for them is "FIFO files."
- Mknod can be used to build named pipes, while rm may be used to delete them.
- The functions of named pipes and local domain sockets are identical, and their existence is largely an artefact of the past.
- If UNIX and Linux were created today, network sockets would probably be used in place of both of them.
No comments:
Post a Comment