Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet26/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   22   23   24   25   26   27   28   29   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014


partitions, and paths.
After a short introduction, we will explore how to get around the Linux file system. We 
view this strictly from the logical point of view as the user is not required (nor even permit-
ted) to interact with the physical file system. It is the operating system which translates the 
user’s commands into physical operations. First, we will look at paths to express source and 
destination locations. We then examine the common Linux commands for navigating the 
file system. We then look in detail at the default structure of a Linux file system so that we 
can learn where programs and files are placed. We also introduce Linux permissions and 
the concept of file compression. Later in the text, we will return to the file system from a 
system administrator’s perspective to see how to manage the file system.
3.1.1 File System Terminology
File system: the collection of storage devices which, combined, make up the system’s file 
space. We can view the file system at two different levels. The logical, or abstract, level 
expresses the collection of files that we have stored, organized hierarchically through 
directories and subdirectories. The physical levels are the devices and how they physically 
store the information such as through magnetic information. At the physical level, files are 
broken into blocks. We will primarily consider the logical level in this chapter, concen-
trating on files and directories. Most users will group common files together into a direc-
tory. Directories and files may be placed into other directories. This provides a hierarchical 
structure to the file system. If organized well, a hierarchy may be several levels deep so that 
the user can easily find a file without resorting to searching for it. Top-level directories are 
placed onto various partitions.
Partition: a disk partition is a 
logical
division of the collection of storage devices into 
independent units. This organizes storage so that different sections are dedicated to dif-
ferent portions of the file system. In Linux, many of the top-level directories are placed in 
separate partitions, such as /home and /var. How does a partition differ from a directory? 
The operating system is able to perform a maintenance operation on one partition without 
impacting other partitions. For instance, one partition might be removed (unmounted) 


Navigating the Linux File System

73
while other partitions remain accessible. One partition might be specified as read-only 
while others are readable and writable. Performing a backup on a partition renders it 
unavailable while the backup is being performed, but other partitions can be available 
if they are not part of the backup. Although partitioning is a logical division, it also sets 
aside physical sections of disk surfaces to different partitions. Partitions are created by the 
system administrator. Directories can be created by any user.
In Linux, common partitions are for the user directory portion (/home), the operat-
ing system kernel and other system files (/, /bin, /sbin, /etc) and the swap space (virtual 
memory). Finer grained partitioning can be made, for instance by providing /usr, /var, 
and /proc their own partitions. Another partition that might be useful is to give the boot 
system (/boot) its own partition. This especially becomes useful if you plan to make your 
computer dual-booting.
Directory: a user-specified location that allows a user to organize files. In Linux, files 
and directories are treated similarly. For instance, both are represented using an inode and 
both have many properties in common (name, owner, group, creation date, permissions). 
Directories will store files, subdirectories, and links. A link is a pointer to a file in another 
directory. There are two forms of links, hard links and symbolic links.
File: the basic unit of storage in the logical file system, the file will either store data 
or an executable program. Data files come in a variety of types based on which software 
produced them. Typically, a file is given an extension to its name to indicate its type, for 
instance, .docx, .mpg, .mp3, .txt, .c. In Linux, many data files are stored as text files mean-
ing that they can be viewed from the command line using commands such as cat, more, 
and less, and can be edited using a text editor (vi, emacs, gedit). Files, like directories, have 
a number of properties. The file’s size may range from 0 bytes (an empty file) to as large as 
necessary (megabytes or gigabytes, for instance).
Path: a description of how to reach a particular file or directory. The path can be abso-
lute, starting at the Linux file system root (/) or relative, starting at the current working 
directory.
inode: a data structure stored in the file system used to represent a file. The inode itself 
contains information about the file (type, owner, group, permissions, last access/create/
modification date, etc.) and pointers to the various disk blocks that the file contains. We 
examine inodes and disk blocks in detail in Chapter 10.
Link: a combination of a file’s name and the inode number that represents the file. A 
directory will store links to the files stored in the directory. Through the link, one can gain 
access to the file’s inode and from the inode, to the file’s blocks. There are two types of 
links, hard and soft (symbolic).
3.1.2 A Hierarchical File System
Linux is a hierarchical operating system. This means that files are not all located in one 
place but distributed throughout the file system based on a (hopefully) useful organizing 
principle. To organize files, we use directories. A hierarchical file system is one that contains 
directories and subdirectories. That is, any given directory not only stores files but can also 
store directories, called subdirectories. Since a subdirectory is a directory, we can apply this 


74

Linux with Operating System Concepts
definition so that this directory can have its own directories, which we might call subsub-
directories. The pathway from the topmost level to the bottommost level of the file system 
represents the depth of the file system. In Linux, there is no limit to the maximum depth.
Most Linux dialects are based on a preestablished standard (the LSB, see Chapter 1). 
This standard includes much of the initial structure of the Linux file system. Thus, you will 
find in just about every Linux operating system top-level directories named /bin, /boot, 
/dev, /etc, /home, /lib, /tmp, /usr, /var, and possibly others. It is this organization that helps 
not only system administrators but all Linux users easily learn where to find useful files.
As a user, you are given your own directory under /home. Within this directory, you are 
allowed to store files and create subdirectories as desired (to within the limit dictated by any 
disk quota, if any). Subdirectories can themselves contain subsubdirectories to any depth.
Figure 3.1 illustrates the concepts of the Linux hierarchy file system. In the figure, we see 
some of the top-level Linux directories, many of which contain subdirectories and subsub-
directories. One user, foxr, is shown, and only two subdirectories of /usr are shown.
When issuing a command, a path is required if the command is not stored in the cur-
rent directory. This is also true if the command is to operate on a specified file which is 
not stored in the current directory. For instance, imagine that the user foxr wants to run 
the program emacs, located in /
usr/bin
, and open the file text1.txt located in foxr’s docs 
subdirectory. The user is currently in his home directory (foxr). A path is required to reach 
both emacs and text1.txt. There are multiple ways to specify paths, as covered in the next 
section. One command is
/usr/bin/emacs /home/foxr/docs/text1.txt
where the first part is the command (emacs) and the second is a file to open within emacs.
3.2 FILENAME SPECIFICATION
3.2.1 The Path
In this and the next subsection, refer to Figure 3.2 as needed. In this figure, we see two top-
level directories, etc and home with home having two subdirectories, foxr and zappaf. The 
items in italics are files.
bin
foxr
docs
downloads
bibtex
text1.txt text2.txt text3.txt
emacs latex
bin
local
etc
home
usr
FIGURE 3.1 
Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   22   23   24   25   26   27   28   29   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish