Page 171 - DCAP602_NETWORK_OPERATING_SYSTEMS_I
P. 171
Unit 10: File System
This statement is true because there are special files that are more than just files (named pipes and notes
sockets, for instance), but to keep things simple, saying that everything is a file is an acceptable
generalization. A Linux system, just like UNIX, 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.
In order to manage all those files in an orderly fashion, man likes to think of them in an ordered
tree-like structure on the hard disk, as we know from MS-DOS (Disk Operating System) for
instance. The large branches contain more branches, and the branches at the end contain the
tree’s leaves or normal files.
10.1 file systems
A file system is an organization of data and metadata on a storage device. With a vague definition
like that, you know that the code required to support this will be interesting.
While it is reasonably safe to suppose that everything you encounter on a Linux system is a file,
there are some exceptions.
1. Directories: Files that are lists of other files.
2. Special files: The mechanism used for input and output. Most special files are in /dev.
3. Links: A system to make a file or directory visible in multiple parts of the system’s file
tree.
4. (Domain) sockets: A special file type, similar to TCP/IP sockets, providing inter-process
networking protected by the file system’s access control.
5. Named pipes: Act more or less like sockets and form a way for processes to communicate
with each other, without using network socket semantics.
The -l option to ls displays the file type, using the first character of each input line:
/Documents> ls -l
total 80
-rw-rw-r-- 1 jaime jaime 31744 Feb 21 17:56 intro Linux.doc
-rw-rw-r-- 1 jaime jaime 41472 Feb 21 17:56 Linux.doc
drwxrwxr-x 2 jaime jaime 4096 Feb 25 11:50 course
This table gives an overview of the characters determining the file type:
table 10.1: file types in a Long List
symbol meaning
- Regular file
d Directory
l Link
c Special file
s Socket
p Named pipe
b Block device
LoveLy professionaL university 165