Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
48 views

File System in Linux

The document discusses the different types of files in a Linux file system: 1) Regular files contain normal data like text, programs, input/output and come in two forms - text and binary. 2) Directories are special files that contain lists of other files and subdirectories. 3) Device files represent peripherals and devices, allowing processes to read/write them like normal files. 4) Links and pipes allow processes to communicate without network sockets. Filenames can use most characters but avoid control codes, and files are organized hierarchically in a tree structure with directories.

Uploaded by

Saw Earic
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

File System in Linux

The document discusses the different types of files in a Linux file system: 1) Regular files contain normal data like text, programs, input/output and come in two forms - text and binary. 2) Directories are special files that contain lists of other files and subdirectories. 3) Device files represent peripherals and devices, allowing processes to read/write them like normal files. 4) Links and pipes allow processes to communicate without network sockets. Filenames can use most characters but avoid control codes, and files are organized hierarchically in a tree structure with directories.

Uploaded by

Saw Earic
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

File System

Types of files:

A simple description of the UNIX system is this: “On a UNIX system, everything
is a file; if something is not a file, it is a process.”
A UNIX system makes no difference between a file and a directory, since a
directory is just a file containing names of other files. Programs, services, texts, images,
and so forth, are all files. Input and output devices, and generally all devices, are
considered to be files, according to the system.
Most files are just files, called regular files; they contain normal data, for example
text files, executable files or programs, input for or output from a program and so on.
While it is reasonably safe to suppose that everything you encounter on a UNIX system
is a file, there are some exceptions.

Directories: files that are lists of other files.

Special files or Device Files: All devices and peripherals are represented by files. To
read or write a device, you have to perform these operations on its associated file. Most
special files are in /dev.

Links: a system to make a file or directory visible in multiple parts of the


system's file tree.

(Domain) sockets: a special file type, similar to TCP/IP sockets, providing inter−process
networking protected by the file system's access control.

Named pipes: act more or less like sockets and form a way for processes to
communicate with each other, without using network socket semantics. (Pipes will be
discussed).

System Administration. P L Patowary. L. C. Bharali College.


Ordinary (Regular) File

This is the most common file type. An ordinary file can be either a text file or a
binary file.
A text file contains only printable characters and you can view and edit them. All
C and Java program sources, shell scripts are text files. Every line of a text file is
terminated with the newline character.
A binary file, on the other hand, contains both printable and nonprintable
characters that cover the entire ASCII range. The object code and executables that you
produce by compiling C programs are binary files. Sound and video files are also binary
files.

Directory File

A directory contains no data, but keeps details of the files and subdirectories that
it contains. A directory file contains one entry for every file and subdirectory that it
houses. Each entry has two components namely, the filename and a unique
identification number of the file or directory (called the inode number). (About inode we
will discuss).
When you create or remove a file, the kernel automatically updates its
corresponding directory by adding or removing the entry (filename and inode number)
associated with the file.

Device File

All the operations on the devices are performed by reading or writing the file
representing the device. It is advantageous to treat devices as files as some of the
commands used to access an ordinary file can be used with device files as well.
Device filenames are found in a single directory structure, /dev. A device file is not really
a stream of characters. It is the attributes of the file that entirely govern the operation of

System Administration. P L Patowary. L. C. Bharali College.


the device. The kernel identifies a device from its attributes and uses them to operate
the device.

Filenames

On a UNIX system, a filename can consist of up to 255 characters. Files may or


may not have extensions and can consist of practically any ASCII character except the /
and the Null character. You are permitted to use control characters or other
nonprintable characters in a filename. However, you should avoid using these
characters while naming a file. It is recommended that only the following characters be
used in filenames:

Alphabets and numerals. The period (.), hyphen (-) and underscore (_).
UNIX imposes no restrictions on the extension. In all cases, it is the application
that imposes that restriction. Eg. A C Compiler expects C program filenames to end with
.c, Oracle requires SQL scripts to have .sql extension.
A file can have as many dots embedded in its name. A filename can also begin
with or end with a dot. UNIX is case sensitive; cap01, Chap01 and CHAP01 are three
different filenames that can coexist in the same directory.

Directories and Files: (Important)

A file is a set of data that has a name. The information can be an ordinary text, a
user-written computer program, results of a computation, a picture, and so on. The file
name may consist of ordinary characters, digits and special tokens like the underscore,
except the forward slash (/). It is permitted to use special tokens like the ampersand (&)
or spaces in a filename. Unix organizes files in a tree-like hierarchical structure, with the

System Administration. P L Patowary. L. C. Bharali College.


root directory, indicated by a forward slash (/), at the top of the tree. See the Figure
below, in which part of the hierarchy of files and directories on the computer is shown.
(Important).

(Question: Briefly study about Linux file system.)

System Administration. P L Patowary. L. C. Bharali College.

You might also like