A Brief Overview of the Unix File System

Introduction 

The Unix File System is a framework for organizing and storing large amounts of data in a manageable manner. It includes components like files, a group of connected data that can be conceptualized as a stream of bytes (or characters). In the Unix File System, a file is also the smallest storage unit. 

In other words, the Unix File System is a method for organizing and logically analyzing massive amounts of data so that it is simple to manage. 

Unix File System: A Brief History 

The Unix File System is a framework that organizes and stores a large volume of data in a manageable manner. It includes components like a file, a group of connected data that, when viewed logically, appears as a stream of bytes and has attributes that provide details about the relevant file. The two main parts of the file system are files and directories. The entire system is organized in a hierarchy, with directories serving as special files that can hold multiple files. The root directory, which is symbolically represented by the letter “/,” is the highest-level directory in the entire hierarchical structure. This directory may have a lot of subdirectories. 

A file system, on the other hand, consists of files, connections to other files, and the characteristics of each file. Data contained within a file is not included in file attributes; they include info about the file. A general operating system’s file attributes could, but need not, include the following: 

  • A file format (i.e., what kind of data is in the file) 
  • The filename (which may or may not include an extension) 
  • Size of a physical file 
  • A file owner’s privacy/protection feature 
  • File time stamp (Time and date created/modified) 

Additionally, file systems offer services that map the logical organization of files to physical devices, tools that enable the manipulation of files, and logical organization. 

Structure of Unix File System 

The Unix File System is essentially made up of files and directories, at least from a beginner’s standpoint. Special files called directories may contain other files. 

The root directory (denoted by /, pronounced slash) is the highest-level directory in the hierarchical (or tree-like) Unix File System. There are several subdirectories immediately below the root level directory, most of which house system files. System files, application files, and/or user data files may be found below this. All files on a Unix system have a parent-child relationship, which is similar to the idea of a process’ parent and children. In other words, files can also have parents and children. As a result, all files—except one—share a common parental link, with the top-most file—/—making an exception. 

List of Unix Files and Their Full Description 

/: The filesystem tree’s root is indicated by the single slash (/) character. 

/bin: Stands for “binaries” and contains some essential tools that are typically required by all users, like ls or cp. 

/boot: This directory houses all the files necessary for a successful boot. 

/dev: The abbreviation for “devices” contains the file representations of auxiliary and fictitious devices. 

/etc: This directory houses system-wise configuration files as well as system databases. It contained “dangerous maintenance utilities” like init at one time but now have been moved to other /sbin or somewhere else. 

/home: The user’s home directories are located here. 

/lib: Home to the system libraries as well as some vital documents like kernel modules. 

/media: It is the standard mount location for removable storage devices like media players, USB sticks, etc. 

/mnt: Abbreviation for “mount” contains mount points for the filesystem. For instance, these are utilized if the system makes use of multiple hard drives or hard disk partitions. Additionally, CD-ROM, remote filesystems, and other devices frequently use it. 

/proc: proc is a  virtual filesystem that displays process data as a file server. 

/root: The home directory of the system administrator, superuser “root.” If specific maintenance is required, during which other filesystems are unavailable, this account’s home directory is typically on the initial filesystem and not in /home. For instance, such a situation might arise if a hard drive experiences failures and cannot be mounted properly. 

/tmp: A directory for its temporary files. Many systems delete this directory when they first boot up. It may have tmp mounted on top of it, in which its contents are lost upon reboot, or a startup script may specifically delete it. 

/usr: It was formerly used to hold user home directories, and its purpose has changed now. It stores shared resources like the Window System, Perl, KDE, and other non-critical system executables, libraries, and resources. On some Unix systems, though, some user accounts might have a home directory that is a subdirectory of /usr, like the standard directory in Minix. 

/var/log: System log files are stored in it. 

/var/mail: The location where all incoming mail is saved. Only users who are not root can access their own mail. This directory frequently serves as a symbolic link to /var/mail command. 

/var/spool: The spool is a directory that contains queued tasks such as mail spools, print jobs, and others. 

/var/tmp: A directory for all temporary files that should be kept between the system reboots. 

Main Types of Files in Unix File System 

All data in the Unix operating system is organized into files. Each file is divided into directories, which are then arranged into a tree-like structure known as a file system. 

In Unix, the following file types are available: 

Ordinary Files 

Ordinary files in Unix are those that contain text, data, and program instructions. 

  • There are no other files in regular files. 
  • The directory file is always put before the regular files. 
  • Our information, such as the text we must write or the image we must draw, is stored in standard files. This is the type of file that we work with most frequently. 

Directory 

Both unique and common files are stored in directories. Users accustomed to the Mac or Windows operating systems will recognize folders as equivalent to Unix directories. Each file’s entry and the subdirectory it houses are included in a directory file. There will be 5 entries in a directory if there are 5 files in the directory. It means that each entry consists of two parts. 

  • The file’s title. 
  • An inode number serves as the file or directory’s specific identification number. 
  • It points where the hierarchical tree branches are available. 
  • It helps us organize the file collection. 
  • It includes additional directories, regular files, or special files. 
  • It doesn’t have “real” data like text that we could use to do our work. 
  • Mostly just required for file organization. 
  • Each file is descended from the root directory (abbreviated /), which is at the top of the tree. 

Special Files 

To represent actual physical devices like a terminal, tape drive, and printer, we use specialized files also employed for I/O (Input/Output) operations. I/O or Input/Output is performed on Linux and Unix systems using special files or devices. They look similar to a file system’s standard file or directory. 

For every device in the Unix system, there are primarily two types of special files: block special files and character special files. 

  • The data is transferred to higher fixed-size blocks if the special block file is used for the device I/O. Block device access is the name for this kind of access. 
  • For the terminal devices, this is done one character at a time. On the other hand, raw access refers to reading or writing across a section of native disk data blocks for disk devices. 

Files are marked with the “c” symbol character. 

Pipes 

In Unix, we can connect commands with the aid of pipes. Pipes function similarly to a temporary file, storing data from one of the commands until the next is ready. The Unix pipe offers a data flow that is only in one direction. The output sequence from the first command serves as an input for the following command sequence. The vertical bar (|) must be positioned between two commands on the command line in order to create a pipe. Such as who | wc -l. 

Sockets 

A particular file type called a “Unix socket” allows for sophisticated internal-process communication. Internal-process communication socket will be another name for it. Unix Sockets are used for the client-server application’s framework. Similar to the network socket, it is essentially a data stream, but each transaction is local to the file system. 

Unix sockets are identified in the output -l using the “s” symbol. 

Symbolic Link 

Another file in the file system is referred to using the symbolic link. We use a symbolic link to refer to another file system file. It contains the path to the file it refers to in text form. A symbolic link may appear to an end user to have its link name, but when we need to write or read data into this file, it will actually refer to the file it is focused on. The data file will still be present even if we delete the soft link itself. If the source file is deleted or moved to another location, the file will not work. 

The symbolic link is indicated in the output of ls -l using the “l” symbol. 

Conclusion 

Because of the incredible features of the Unix File System, Unix OS is used for file management. Managing files is incredibly simple with the commands and functions available. Permissions also restrict the files’ access. Authorized people can only access the files and various operations. Additionally, it is simpler to use because different file types are separated in it. Thus, the Unix File System is regarded as one of the most user-friendly file systems. For more knowledge on hot tech topics and certification, do check out UNext.

Related Articles

loader
Please wait while your application is being created.
Request Callback