5.1.3. Structure of File System; root, boot, bin, lib, dev

 Back  Linux  Next


Files, directories and devices Linux OS are placed into a single file system (as noted above, all of the files), which means it's all incorporated into one large hierarchical structure in which the devices per se do not see particularly, as is the case with Windows OS. For example, Linux has the xorg.conf file that is relative to the top-root (root) file structure tree labeled with [ / ], located in the directory [etc] top affiliate structure, in which the subdirectory [X11], or simplified file [/etc/X11/xorg.conf]. Nowhere does it state a disk as you would with Windows XP operating system was as [C:\WINDOWS\system32\oeminfo.ini] where you see the affiliation partition [C:]. Therefore, for effective 'walk' through the tree crown Linux should recognize him. Structure of Debian Linux filesystem is shown below. The image is mapped and each rectangle is the link to the proper description. Same is applied for individual rectangles corresponding descriptions to return to this picture.

 FSSTND  root  bin  dev  home  mnt  ROOT  tmp  var  ostalo  boot  etc  lib  proc  sbin  usr  lost+found  usr/ bin  usr/ lib  usr/ sbin  Upravo ovdje  Natrag za jedan nivo
Figure 5.1.8 Structure of the Filesystem at Linux operating system.

Most Linux distributions are generally shown holding structure, which is defined by the unofficial standard 'Linux File System Hierarchy Standard' (FSSTND) that defines the name and location of many directories and files located somewhere on the Internet (Google?). Individual rectangles in the figure are also the coupling to the contents that describe them. When creating the directory it would be good to have [/bin], [/lib] and [/sbin] on the same partition, and the recommendation is to have on that partition and [/root] and [/etc].

File systems supported by Linux are 'journaling' type (for example, not FAT), which means you only have the option of recovery in case of a sudden shut down the computer (no UPS?). Because all the files are indexed (listed) in the JOURNAL, the tracks on a separate part of the disc which recorded changes as needed, and then entered into the file, which prevents data loss and damage to the file system. Resistance to mistakes increases SUPERBLOCK or its copies in multiple locations (redundant blocks) on the disk. It contains information about the file system as a whole, from its size to the data, where we begin each directory onwards (similar to the FAT table) for each file system (partition) in particular.

 Coupling Figure 5.1.2 with all subimages displayed as per the command ' ls -al ' in the root directory, see the operating system directories that are currently under review. As noted above, the disk partition as an element of the system will be displayed in the file structure. At the very top of each directory you see two special files ' . ' and ' .. ' (similar to the DOS operating system) that have the task of:

  • . ' - Marks the top of the existing directory that is viewed. It could be interpreted as a label 'HERE' or 'THIS' directory. The superior directory is the parent directory of this. Each directory has its parent, except the root, and the rights of the parent, in principle, are INHERITED by the newly created files that belong to the parent. 'Family Ties' can only be replaced by a superuser (root).
  • .. ' - Coupling to the superior (parent) directory relative to the directory that is marked in the previous point. It could be interpreted as an indication to switch to the directory immediately 'on top' of this directory, one level higher. Moving to higher level from the current command is done ' cd .. '.
 

The above points are nothing to guide through the file system that allow the transition from one directory to other directory at higher level. Rights of these two files are always ' drwxr-xr-x ', which means they have peculiarities directory and enable 'moving' through the file system as a guideline.

 Root of hierarchical structure Label the root directory, i.e. the top-origins of hierarchical structure of the file system that can connect all the other directories or file systems that belong to either the same partition where the source file system [ / ] (or marks [ Linux / ] to Figure 5.1 and 5.1.7), or any other which is attached to the origin (mount). Since this is the first place that the core fetches there are almost no files. There are directories with only the necessary symbolic staples and all together do not form a significant size regarding occupancy disk. Character ' .. ' at this point there is no significance, but the character ' . ' has, because it means that it is possible here, for example, a copy. Direct transition to the level of origins of from anywhere is made with command ' cd / '.

 root-dir Directory that is nothing more than a place where to keep configuration files superuser. Or the it is the 'home' directory superuser, which can be detected in the elements of which it is composed PROMPT - voda:~#. Since this directory does not take a lot of data and must be constantly available superuser not installed on a separate partition or some other place, but in the root of the file tree structure. Since data superuser not take up a lot of [ Linux / ] partition does not require much space, only a few hundred MB. If you are in this directory will be a mailbox can be need a little more space. With modern disks 1 GB for the root partition is more than enough.

 boot-dir Directory that does not necessarily have to be on a separate partition as per Figure 5.1, but in this example, so it shows occasional Linux distributions require just such a structure. In this directory there is a BOOT_LOADER and its configuration file, directory GRUB or LILO depending on who uses LOADER with associated facilities and their copies of the core (kernel images) files with names that begin with the prefix initrd*, which may have an extension .img though not necessarily. There are kept and their associated configuration files. Since copies of the core does not take up too much disk space this partition does not require a lot of places, only a few hundred MB. With modern disks 1 GB is more than enough, and can be stored without fear copies of several versions of kernel.

 bin This directory contains binary executable files available to all users who are logged into the system. This means that the system must be made-open ACCOUNT. Controls are the key words used by the specified syntax for the operating system and transmits them COMMAND INTERPRETER - SHELL. Default Debian shell is BASH and it is also quite large command options. If the BASH is command means you can refer to the execution. Then in the existing shell creates a working shell. While working in the new shell initial idle. So it can go out of the shell and the shell if they are installed other types of scales can be used in this manner. In addition to the controls in this directory is also a small number of symbolic links to directory [/sbin], which also contains a large number of commands but primarily intended for the administrator. All files in this directory have the rights ' -rwxr-xr-x ' and symbolic links have rights ' lrwxrwxrwx '. Thus, only the administrator can replace a command with a new version of her or change her name (option ' w '). Directory contains hundreds of files and there is no subordinate directories. There are no files of individual services, but basic users can create directory, copy the file, and so on.

 drago@voda:~$ dir /bin
 bash     dmesg          hostname  mount           ping6      stty        which
 busybox  dnsdomainname  ip        mountpoint      ps         su          zcat
 cat      echo           kill      mt              pwd        sync        zcmp
 chgrp    ed             ln        mt-gnu          rbash      tailf       zdiff
 chmod    egrep          loadkeys  mv              readlink   tar         zegrep
 chown    false          login     nano            rm         tempfile    zfgrep
 cp       fgconsole      ls        nc              rmdir      touch       zforce
 cpio     fgrep          lsmod     nc.traditional  rnano      true        zgrep
 date     grep           mkdir     netcat          run-parts  umount      zless
 dd       gunzip         mknod     netstat         sed        uname       zmore
 df       gzexe          mktemp    pidof           sh         uncompress  znew
 dir      gzip           more      ping            sleep      vdir
 drago@voda:~$ 
 drago@voda:~$ ls -al | grep lrwx
 lrwxrwxrwx  1 root root     20 2010-04-18 11:43 mt -> /etc/alternatives/mt
 lrwxrwxrwx  1 root root     20 2010-04-18 11:43 nc -> /etc/alternatives/nc
 lrwxrwxrwx  1 root root     24 2010-04-18 11:43 netcat -> /etc/alternatives/netcat
 lrwxrwxrwx  1 root root     16 2010-04-18 11:42 pidof -> ../sbin/killall5
 lrwxrwxrwx  1 root root      4 2010-04-18 11:42 rbash -> bash
 lrwxrwxrwx  1 root root      4 2010-07-31 22:02 rnano -> nano
 lrwxrwxrwx  1 root root      4 2010-04-18 11:42 sh -> bash
 drago@voda:~$

The command ' dir ' displays the contents of the directory to which it relates. In this case it refers to a directory that is relative to the ' / ' is called ' bin ' and is located at the top of the hierarchical structure of a directory. Command line ' ls -al | grep lrwx ' example is the concatenation of commands that tells the complete list of isolate and display only links. In this directory there is no honest text editor, but only one rudiments line-oriented text editor ' ed '. From the example shows that commands to view the contents of the directory ' dir ' and ' ls ' does not give the same print as used are different options, although for both commands are essentially the same options.

 lib Libraries are an essential part of any operating system. It is a set of software routines (objects) that are used when creating computer programs or software uses in the work in order to make her a set task. These routines are located in the directory [/lib] in which the extra directories associated with their files, and the peculiarity of a file which usually begin with the prefix lib* in the name and have the extension .so or .a. Types of libraries are:

In Windows operating systems .so files are equivalent .dll files. In this directory are dynamically available files type .so because, according to their function belongs more to the needs of 'ordinary' users and for easy reach of the program application directory with the files located in the root directory of the system on the same partition as a directory [/bin].

 sbin In this directory are typical tools (software support) needed an administrator, that an ordinary user can not use it. For example, the command ' init ', with which it is possible to change the level of usability of computers.

 drago@voda:~$                                    (working directory of user 'drago')
 drago@voda:~$ whoami                             (who I am on the computer?)
 drago
 drago@voda:~$
 drago@voda:~$ cd /sbin                           (move to the directory [/sbin] )
 drago@voda:/sbin:$ dir
 badblocks        fsck.ext3          iptables-restore  mkswap        ss
blkid fsck.ext4 iptables-save modinfo startpar
blockdev fsck.ext4dev iptunnel modprobe start-stop-daemon
bootlogd fsck.minix isosize nameif sulogin
cfdisk fsck.nfs kbdrate pam_tally swapoff
ctrlaltdel getty killall5 pivot_root swapon
debugfs grub-install ldconfig plipconfig sysctl
depmod halt logsave poweroff tc
dhclient hwclock losetup rarp telinit
dhclient3 ifconfig lsmod raw tune2fs
dhclient-script ifdown MAKEDEV reboot udevadm
dumpe2fs ifup mii-tool resize2fs udevd
e2fsck init mke2fs rmmod udevsettle
e2image insmod mkfs route unix_chkpwd
e2label installkernel mkfs.bfs rtacct unix_update
e2undo ip mkfs.cramfs rtmon update-grub
fdisk ip6tables mkfs.ext2 runlevel update-modules
findfs ip6tables-restore mkfs.ext3 sfdisk vol_id
fsck ip6tables-save mkfs.ext4 shadowconfig
fsck.cramfs ipmaddr mkfs.ext4dev shutdown
fsck.ext2 iptables mkfs.minix slattach
drago@voda:/sbin:$ drago@voda:/sbin:$ ls -al | grep init (view a certain part of the list above) -rwxr-xr-x 1 root root 31296 2008-08-12 16:09 init
lrwxrwxrwx 1 root root 4 2010-04-18 11:42 telinit -> init drago@voda:/sbin:$

Symlink ' telinit ' in the example leads to the ' init ' file in the same directory was created to preserve the already earlier conventional name or link to it going in some other place that does not know the command ' init ' but he knows the command ' telinit ' that he needs. According to the case could be concluded by a normal user, which is determined look or PROMPT command ' whoami ' that lists his name, has the right to call these files to execute (-rwxr-xr-x). No, because the ROOT user is not assigned to another user in the group and what should not be one ROOT. Thus, the rights do not depend only to a record in the first column. In addition to the foregoing, according to the available time is different directories for users and administrator. Command ' set ' a multitude of variables including the environment can be seen:

 path    (/bin /usr/bin /usr/local/bin /usr/bin/X11 /usr/games)

 path    (/bin /sbin /usr/bin /usr/sbin /usr/bin/X11 /usr/local/bin /usr/local/sbin)

Ordinary user can execute only view the contents of this directory and nothing else.

As already noted, on the part of these files go direct symbolic links in the directory [/bin] and only them can use a normal user. Ordinary users can not use the command ' init 6 ' for example, which initiated the shutdown of computer and its re-launch without a physical shutdown (reboot) or command ' init 0 ' that physically turns off your computer (shutdown). The numbers listed are the levels of Chapter 5.1.1.

 dev Here are located special files that represent hardware computer it is installed on this operating system. By enrolling in this file or reading it directly contacts the appropriate circuit of computer, and therefore the complete rights of these devices is realized mainly by the administrator. In the event that the device can be created using the MAKEDEV script.

 voda/dev# ls -alh | more
 total 4.0K
drwxr-xr-x 12 root root 3.3K 2010-07-31 21:08 .
drwxr-xr-x 21 root root 4.0K 2010-04-18 11:44 ..
crw-rw---- 1 root audio 14, 4 2010-07-31 21:08 audio
drwxr-xr-x 2 root root 640 2010-07-31 21:08 block
lrwxrwxrwx 1 root root 3 2010-07-31 21:08 cdrom -> hdc
drwxr-xr-x 2 root root 2.4K 2010-07-31 21:08 char
crw------- 1 root root 5, 1 2010-07-31 22:01 console
:
lrwxrwxrwx 1 root root 3 2010-07-31 21:08 dvd -> hdc
lrwxrwxrwx 1 root root 13 2010-07-31 21:08 fd -> /proc/self/fd
brw-rw---- 1 root floppy 2, 0 2010-07-31 21:08 fd0
crw-rw-rw- 1 root root 1, 7 2010-07-31 21:08 full : -rw-r--r-- 1 root root 0 2010-07-31 21:08 .initramfs-tools : srw-rw-rw- 1 root root 0 2010-07-31 21:08 log :
brw-rw---- 1 root disk 3, 0 2010-07-31 21:08 hda
brw-rw---- 1 root disk 3, 1 2010-07-31 21:08 hda1
brw-rw---- 1 root disk 3, 2 2010-07-31 21:08 hda2
brw-rw---- 1 root disk 3, 5 2010-07-31 21:08 hda5
brw-rw---- 1 root cdrom 22, 0 2010-07-31 21:08 hdc
:
lrwxrwxrwx 1 root root 13 2010-07-31 21:08 MAKEDEV -> /sbin/MAKEDEV
:
crw-rw-rw- 1 root root 1, 3 2010-07-31 21:08 null
crw-r----- 1 root kmem 1, 4 2010-07-31 21:08 port
:
lrwxrwxrwx 1 root root 15 2010-07-31 21:08 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 2010-07-31 21:08 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 2010-07-31 21:08 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 2010-07-31 21:08 tty
crw-rw---- 1 root root 4, 0 2010-07-31 21:08 tty0
crw------- 1 drago tty 4, 1 2010-07-31 22:51 tty1
:
prw-r----- 1 root adm 0 2010-07-31 23:11 xconsole
crw-rw-rw- 1 root root 1, 5 2010-07-31 21:08 zero voda/dev#

According to the example shown in the first letter the right of files (_rwxrwxrwx) may have the following signs and meaning:

Directories contain devices that belong to one of these groups. These devices contain the main and secondary identification number under which retrieves a device driver in the core. So, everything in this directory is a guide to the core.


 Back
 Search
 Next

 Content - Home
 Content  Informatics Alphabet
 
Citing this page:
Radic, Drago. " IT - Informatics Alphabet " Split-Croatia.
{Date of access}. <http://www.informatics.buzdo.com/>.
Copyright © by Drago Radic. All rights reserved. | Disclaimer