Linux file systems guide
Now that you've learned how to run Linux and
shut down the system, must become acquainted with the device
one of its major parts - the file system. File
system in Linux is a structure through which the nucleus
operating system allows users (and processes)
resources long-term memory system, ie, memory
different types of long-term storage media -
hard disks, magnetic tapes. CD-ROM, etc.
Related links:
Linux cluster file system is based on a strict Linux file system hierarchy.
Like the moon, which is addressed to us is always one
side, the file system is also addressed to the user (perhaps
better to say - to the applications) is constantly on one side. C
This, visible to the user side, the file system looks
as the logical structure of directories and files. But she has another
the side facing the media, forming the internal (from the point
the user) the device file system. This invisible
side of the file system is arranged far from simple. In fact,
that it implements the mechanisms to put the files on different media
access algorithms (sample required information) and more.
Related links:
In this section we consider the file system
only from the side that faces the user. Reverse,
invisible to the user side of the file system, we will
study in Chap. 16 . We still may be noted that this
to go specifically to the filesystem type ext2fs, mainly at the
when the type of file systems for Linux (there are other types of
file systems, this too will be discussed in Chap. 16 ).
Related links:
4.1. Files and their names
Computer is nothing more than a tool for
processing. And the information in any OS is stored on media in
as files. In terms of the OS file is a continuous
stream (or sequence) of bytes of a certain length. Internal
file format the operating system is not interested. But the OS should give
file some name by which the user, or rather
software applications that will access the file. How to organize this
treatment - the case file system, the user is more
just not interested. Therefore, a user file
system looks like the logical structure of directories and files.
File names in Linux can be up to 255
characters and consist of any symbols except with the code 0 and
symbol / (slash). However, there are a number of characters that are in
shell shell special meaning and are therefore not
encouraged to include in the names. These are the characters:
! @ # $% & ~ * () [] () '"
\:,> <`Gap.
If the file name contains one of these characters (this
not recommended, but possible), then you need before this symbol
put a backslash "\" (including front
by this slash, ie, repeat it twice).
[user] $
mkdir \ \ my \ & his
Can also enter the name of a file or directory
such symbols in double quotes. For example, to create a directory with
called "My old files" should use the command:
[user] $
mkdir "My old files"
As a team
[user] $
mkdir My old files
Create a directory named "My".
Similarly, we can proceed with other
characters listed above, ie, they can include the names of
file if the file name to take in double quotes or cancel
special meaning to the symbol with a backslash. Yet
preferable not to use these characters, including space, in
names of files and directories, because it may have problems
accessing such files from several applications, as well as
transfer these files in other file systems.
But to the point above does not include ,
and Linux often put more than one point in the file names, for example,
This_is.a.forth-chapter_of_my_book.about.Linux. It loses meaning
such a notion (adopted in DOS), as the file name extension, although
as is often the last part of the name, separated by periods, used to
designate files to any particular types (eg,. tar.gz
used to refer to compressed archives). But the executable and
non-executable files in Linux is not recognized by name extensions
files. There are other signs that we say
later. The point is of particular importance in file names. If it
is the first symbol of the name, then this file is hidden for
Some teams, for example, it is not displayed when you run
ls .
In Linux different upper and lower
Register in file names. Therefore FILENAME.tar.gz and filename.tar.gz
may well exist simultaneously and be the names of different
files.
We used to assume that the file is
defined by its name. But in terms of OS and filesystem
it is a little less (or more accurately, not at all). While we are talking about
the internal structure of the file system only at the end of the book ( Chap.
16 ), something must be said now.
Each file in Linux corresponds to the so-called
"Inode" file, or "inode",
(Unambiguous translation of this term into Russian language does not exist in
different books of this structure is called differently). This index
descriptor contains all necessary file system information
file, including information about the location of parts of the file on the media
file type and more. Inode contains a
special table (inode table), which is created when you create
file system on the media. Each logical and physical disk
has its own table of inodes. Descriptors this
Tables are numbered sequentially, and that number descriptor
file is its true name in the system (this number, we will
call the index file). However, for a man, such a system of names
uncomfortable. Can you remember what saved the file number
56,734? Therefore, the files are given more "human" names, and
in addition, files are grouped into catalogs.
The above information is needed here only for
To say that the name of any file in Linux is nothing more than
other than a reference to the inode. Therefore, each file
can have any number of different names. These names are also called
"Hard" links. When you delete a file that has
several different names - hard links, it actually
removed only one link - the one you specified in
command to remove the file. Even when you delete the last link, it
still may not mean delete the contents of the file - if
file is used by the system or some application, it
persists as long as he does not "liberated".
In order to give the file (or directory)
secondary name (create a hard link), use the command ln
in the following format:
ln
imya_suschestvuyuschego_fayla novoe_imya
Example:
[user] $
ln / home / howto / font-HOWTO-ru / Font-HOWTO.html ~ / fonts.html
(Special character ~ here
and generally in the system means the user's home directory, which
will be discussed a bit further). Now you can substitute the long name
/ Home / howto / font-HOWTO-ru / Font-HOWTO.html just use
~ / Fonts.html . More information about the team ln
You can read on page interactive guide man .
Number of hard links to the file (ie, different
file names) can be found by typing ls
with parameter -l .
Immediately after the transfer of access rights to the file should be a number, and that
denotes the number of hard links to the file:
[user] #
ls-l
total
9
drwxr-xr-x
2 user users 1024
Jul 1 2000 Autostart
-rw-r - r -
1 user users 230
Sep 14 1999 Printer.kdelnk
-rw-r - r -
1 user users 159
Sep 15 1999 Red Hat
Read more:
|