Fundamental of Computing Week 9: 9 October to 15 October (The Linux Filesystem)

 The Linux Filesystem

Definitions

  • Linux file system is a built-in layer of a Linux operating system that handles storage data management.
  • The Linux file system is organized in a tree-like manner. The directory tree is another name for the tree like structure. It maintains a file's name, size, creation data, and much more information.
  • A filesystem's primary function is to represent and arrange the system's storage resources.
  • It includes a root directory that contains other files and folders.
  • While Windows users commonly use the term folder, in Linux terminology folders are referred to as directories.

Pathnames

  • A pathname is a text string made up of one or more names separated by forward slashes (/).
  • A pathname is a path of names that indicates how to find something in the hierarchical file system tree.
  • Here are some examples of pathnames:
    •  /home
    • /etc/passwd
    • usr/wc
    • /var/ntpstats/loopstats
  • A single name doesn't need any slashed as separators.
  • The filesystem is represented as a single unified hierarchy that begins with the directory and descends via an arbitrary number of subdirectories.
  • UNIX/Linux files are arranged in a single tree hierarchical file system structure composed of data files and directories.
  • The relative path is tied to the current directory, whereas an absolute path indicates the location from the root directory.

File Types in Linux

  • Everything in a Linux system is a file, and anything that isn't a file is a process.
  • The majority of file system implementations define seven file types.
  • Even when developers add something new and fantastic to the file tree, it must still appear like one of these seven types:
    • Regular files
    • Directories
    • Character device files
    • Block device files
    • Local domain sockets
    • Named pipes (FIFO)
    • Link files

Regular or Ordinary Files

  • Text, audio, video, photos, scripts, and programs are examples of regular or ordinary files that store data of various content types.
  • The vast majority of files found on UNIX and Linux are standard files.
  • Regular files in Linux can be generated with or without an extension.
  • Regular files begin with the letter -

Directories

  • A directory is a collection of named references to other files.
  • It is a binary file that is used to monitor and find other files and folders.
  • You can use mkdir to create directories and mkdir to delete them if they are empty.
  • File systems employ directories to organize files in a hierarchy.
  • The Linux file system begins with the directory /, sometimes known as root directory.
  • The directory is where all files and directory files are produced. Each directory, with the exception of the root directory, has a parent directory.

Character Device and Block Device File (Special Files)

  • All hardware devices are treated as special files in Linux.
  • A special file's aim is to expose the device as a file in the file system.
  • File I/O tools can access the device, a particular file provides a universal interface for physical devices.
  • When data is read from or written to a special file, the operation occurs instantaneously and is not governed by standard filesystem rules.
  • A character special file is a device that sends data in bytes, such as a monitor or printer. A block special device, such as a hard disk, that transfers data in blocks.
  • A block special file hat gives access to a device that transfers data in fixed-size groups. As an example, consider a disk.
  • A character special file that allows access to a device that transfers in single character increments, such as a terminal.

Socket Files

  • Applications use sockets as communication endpoints to share data.
  • For instance, if a local system program wishes to talk to a remote system application, it connects that application's socket using the socket's associated IP address and port number.
  • A socket is used by each application that offers services to remote customers or other programs.
  • Each socket has a port number and IP address that enables it to receive connections from clients.
  • Linux employs socket files to simplify communication between local applications.
  • Applications running on the local system can communicate data using socket files without having to go through the difficult networking and sockets and process.
  • Instead of using an IP address and port number, socket files utilize a file name as their address.
  • The sendmsg() and recvmsg() system functions are used by socket files to provide inter-process communication between local programs. 

Named Pipes (FIFO Files)

  • Named pipes, like local domain sockets, allow communication between two processes running on the same host. Also known as FIFO files.
  • Use of command mknod to construct named pipes and command rm to delete them.
  • Named pipes and local domain sockets provide similar functions, and their existence is largely historical.
  • If UNIX and Linux were designed today, neither would exist; network sockets would take their place.


Link Files: Hard Link and Soft Link Files

  • a link file is a file that points to another file. 
  • Link files enables to use a file that has a different filename and is located in a different location.
  • A had link and a symbolic or soft link are the two sorts of linkages.
  • Hard link and soft link:
    • A hard link makes a duplicate of the original file.
    • A hard link to a directory or file on another filesystem cannot be formed.
    • A symbolic or 'soft' link refers to a specific file by name.
    • a soft link can be formed to another filesystem's directory or file.





 






 








Comments

Popular posts from this blog

Fundamental of Computing Week 9: 9 October to 15 October (Basic Commands in Linux)

Fundamental of Computing Week 12: 30 October to 5 November (Client Server Architecture)

Fundamental of Computing Week 10: 16 October to 22 October (Linux Network and Process Management)