0
4.2kviews
Linux file system

Mumbai University > Information Technology > Sem 5 > Operating System

Marks: 10M

Year: Dec 2015

1 Answer
0
19views

File

  • A file is a named collection of related information that is recorded on secondary storage such as magnetic disks, magnetic tapes and optical disks. In general, a file is a sequence of bits, bytes, lines or records whose meaning is defined by the files creator and user.

File Structure

A File Structure should be according to a required format that the operating system can understand.

  • A file has a certain defined structure according to its type.
  • A text file is a sequence of characters organized into lines.
  • A source file is a sequence of procedures and functions.
  • An object file is a sequence of bytes organized into blocks that are understandable by the machine.
  • When operating system defines different file structures, it also contains the code to support these file structure. Unix, MS-DOS support minimum number of file structure.

File Type

File type refers to the ability of the operating system to distinguish different types of file such as text files source files and binary files etc. Many operating systems support many types of files. Operating system like MS-DOS and UNIX have the following types of files

Ordinary files

  • These are the files that contain user information.
  • These may have text, databases or executable program.
  • The user can apply various operations on such files like add, modify, delete or even remove the entire file.

Directory files

  • These files contain list of file names and other information related to these files.

Special files

  • These files are also known as device files.
  • These files represent physical device like disks, terminals, printers, networks, tape drive etc.

These files are of two types −

  • Character special files − data is handled character by character as in case of terminals or printers.
  • Block special files − data is handled in blocks as in the case of disks and tapes.
  • Everything in Linux can be reduced to a file. Partitions are associated with files such as /dev/hda1. Hardware components are associated with files such as /dev/modem. Detected devices are documented as files in the /proc directory. The Filesystem Hierarchy Standard (FHS) is the official way to organize files in Unix and Linux directories.

Linux file system and directory structure

  • Several major directories are associated with all modern Unix/Linux operating systems. These directories organize user files, drivers, kernels, logs, programs, utilities, and more into different categories.
  • The standardization of the FHS makes it easier for users of other Unix-based operating systems to understand the basics of Linux. Every FHS starts with the root directory, also known by its label, the single forward slash (/). All of the other directories shown in Table are subdirectories of the root directory. Unless they are mounted separately, you can also find their files on the same partition as the root directory.
/ The root directory, the top-level directory in the FHS. All other directories are subdirectories of root, which is always mounted on some partition. All directories that are not mounted on a separate partition are included in the root directory?s partition.
/bin Essential command line utilities. Should not be mounted separately; otherwise, it could be difficult to get to these utilities when using a rescue disk.
/boot Includes Linux startup files, including the Linux kernel. Can be small; 16MB is usually adequate for a typical modular kernel. If you use multiple kernels, such as for testing a kernel upgrade, increase the size of this partition accordingly.
/etc Most basic configuration files.
/dev Hardware and software device drivers for everything from floppy drives to terminals. Do not mount this directory on a separate partition.
/home Home directories for almost every user.
/lib Program libraries for the kernel and various command line utilities. Do not mount this directory on a separate partition.
/mnt The mount point for removable media, including floppy drives, CD-ROMs, and Zip disks.
/opt Applications such as WordPerfect or StarOffice.
/proc Currently running kernel-related processes, including device assignments such as IRQ ports, I/O addresses, and DMA channels.
/root The home directory of the root user.
/sbin System administration commands. Don't mount this directory separately.
/tmp Temporary files. By default, Red Hat Linux deletes all files in this directory periodically.
/usr Small programs accessible to all users. Includes many system administration commands and utilities.
/var Variable data, including log files and printer spools.

Types of Files Used by Linux

  • When working with Linux, you need to be aware of the fact that there are a number of different file types used by the file system. This is another area where the Linux file system differs significantly from the Windows file system. With a Windows file system you basically have two entry types in the file system:
  • Directories
  • Files

  • Granted, you can have normal files, hidden files, shortcut files, word processing files, executable files, and so on. However, these are all simple variations of the basic file when working with Windows. With Linux, however, there are a variety of different file types used by the file system. These include the file types shown in Table

File Type Description
Regular files These files are similar to those used by the file systems of other operating systems—for example, executable files, OpenOffice.org files, images, text configuration files, etc.
Links These files are pointers that point to other files in the file system.
FIFOs FIFO stands for First In First Out. These are special files used to move data from one running process on the system to another. A FIFO file is basically a queue where the first chunk of data added to the queue is the first chunk of data removed from the queue. Data can only move in one direction through a FIFO.
Sockets Sockets are similar to FIFOs in that they are used to transfer information between sockets. With a socket, however, data can move bi-directionally.
Please log in to add an answer.