Dilla University
College of Engineering and Technology
School of Computing and Informatics
Computer Science program
Network and System Administration
November 2017
Dilla University
CHAPTER TWO
What is Linux, file system and System
Architecture
Introduction to Linux
Unix is a multi-user, multi-tasking operating system.
You can have many users logged into a system
simultaneously, each running many programs.
It's the kernel's job to keep each process and user separate
and to regulate access to system hardware, including cpu,
memory, disk and other I/O devices.
History of UNIX
First Version was created in Bell Labs in 1969.
It was given the name UNIX by Brian Kernighan.
00:00:00 Hours, Jan 1, 1970 is time zero for UNIX.
It is also called as epoch.
1973 Unix is re-written mostly in C, a new language
developed by Dennis Ritchie.
Being written in this high-level language greatly decreased
the effort needed to port it to new machines.
History of UNIX
1977 There were about 500 Unix sites world-wide.
1980 BSD 4.1 (Berkeley Software Development)
1983 SunOS, BSD 4.2, System V
1988 AT&T and Sun Microsystems jointly develop System V
Release 4 (SVR4).
1991 Linux was originated.
What is LINUX
Linux is a free Unix-type operating system originally created
by Linus Torvalds with the assistance of developers around the
world.
It originated in 1991 as a personal project of Linus Torvalds,
a Finnish graduate student.
Developed under the GNU General Public License , the
source code for Linux is freely available to everyone.
LINUX Distributions
Ubuntu: [Link]
Debian: [Link]
RedHat: [Link]
Fedora: [Link]
SuSE/Novell: [Link]
Mandrake: [Link]
INTRODUCTION
what is directory?
it’s bunch of system files and also data files.
what is directory in Linux?
it’s same meaning in Linux but in the Linux there is only one
root.
how the Linux directory differ from that of familiar windows?
in windows every drive has it’s own root , opposite to it , in
linux only single drive and single root.
WHAT IS FILE SYSTEM ?
It is a method of storing and organizing computer files and
their data.
Essentially, it organizes these files into a database for the
storage, organization, manipulation, and retrieval by the
computer's operating system.
eg:- fat, ntfs, ext4, ext3.......
FILE SYSTEM HIERARCHY
To put it simply, it can be visualized as a tree with its roots
and all.
At the top of the hierarchy is invariably the root path which is
represented by '/'.
All other directories are created beneath this root path in
Linux.
FLOW CHART
ROOT
Root is ambiguous in one respect.
1. It can refer to the top of the file structure.
2. It can also be the name of the Administrator type
account in Linux.
ROOT
DIFFERENCE BETWEEN ‘/’ AND ‘/ROOT’
1. /
‘/’ is called as a root.
It’s Root directory.
Root of the all file systems of linux.
Every directory is “under” root ultimately.
/ROOT
Root is the user with God-like powers over the system. !!!
It’s administrative(root) user’s home directory.
Generally, it is the home directory of root user.
Root is the name of system Admin.
/Root = system admin or Super User directory.
/ROOT
Why not in '/home'?
Because '/home' is often located on a different partition or
even on another system and would thus be inaccessible to
'root' when - for some reason - only '/' is mounted.
/BOOT
This directory contains everything required for the boot process except
configuration files not needed at boot time and the map installer.
Contains the boot loader , Grub and Linux kernel
Stores data that is used before the kernel begins executing user-mode
programs.
/boot is static and unsharable directory.
If /boot is lost , then we can’t boot os .
/BIN
Bin Stands for binary
Need for system startup
Used by everyone in terminal
Shells like bash, csh
No subdirectories in /bin
Basic commands for
1. Navigating in file system
2. File management
/SBIN
Contains binary (executable) files, usually for system
administration.
Binary files used usually for system administration.
Only root can access.
System configuration programs
1. Format hard disk
2. Manage hardware
/BIN VS /SBIN
/bin directory contains executable programs which are
needed in single user mode and to bring the system up or
repair it.
/sbin Like /bin, holds commands needed to boot the sys-
tem, but which are usually not executed by normal users.
/OPT
This directory contains all the software and add-on
packages that are not part of the default installation.
Again, this directory is not used very often as it's mostly a
standard in Unix installations.
“optional” software
/opt/bin, /opt/doc, /opt/include, /opt/info, /opt/lib, and
/opt/man
installed under either /opt/ or /opt/ subdirectory.
/SRV
srv stands for service.
site-specific data
Contains server specific services related data.
For example, /srv/cvs contains CVS related data.
/TMP
This directory contains mostly files that are required
temporarily.
This directory is cleared out at boot or at shutdown.
/LIB
All essential libraries which are needed for system startup
Windows equivalent to a shared library would be a DLL
(dynamically linked library) file
Also in this directory are kernel modules
Other library locations for other programs include /usr/lib and
/usr/local/lib
Generally these correspond to where the binary is installed, i.e. a
binary in /usr/bin would put a library in /usr/lib, and a binary in
/usr/local/bin would put a library in usr/local/lib
/DEV
Stands for devices.
When you first boot up your computer it detects your
hardware and place folder and files representing your
hardware in the dev directory.
Linux file system : everything is a file or a directory.
So device is treated as file. Usually It is the location of
device files
C:\Windows\System in Windows Contains a file describing
every device, and these files can send data to each device.
/DEV
It is equivalent to a mashup of the Device Manager.
A device and a file both can be read from and written to.
So config a device is same with edit a file.
/ETC
Is where configuration files get stored.
A "configuration file" is a local file used to control the
operation of a program; it must be static and cannot be an
executable binary
It is recommended that files be stored in subdirectories of
/etc rather than directly in /etc.
/ETC
More importantly, the /etc/rc.d directory contains the system startup
scripts.
This is a good directory to backup often.
Saves lot of re-configuration later if you re-install or lose your current
installation.
Fstab : Static information about filesystems.
Group : User group file.
Passwd : This is the password file, but it contains more: user name, user
password, userID, group ID, home directory, and shell.
/ETC
It can optionally contain the user's “real name”.
/etc/hostname : Contains the hostname of your machine
/etc/hosts : This file is used to define a system name and
domain combination with a specific IP address
/etc/inittab:
/etc/fstab: system what drive to access, and where to mount
it in your System.
/HOME
Is a fairly standard concept, but it is clearly a site-specific file
system.
No program should assume any specific location for a home
directory, rather it should query for it.
Linux is a multi-user environment so each user is also assigned a
specific directory which is accessible only to them and the system
administrator.
containing saved files, personal settings, etc.
/MNT
Mounting is the process by which you make a filesystem
available to the system.
Mount point for temporary mounted file system.
Points for removable devices that have been mounted
manually.
/MEDIA
On modern Linux systems the /media directory will contain the
mount points for removable media such as,
1. USB drives,
2. CD-ROMs, etc.
that are mounted automatically at insertion.
/PROC
Pseudo file system residing in the virtual memory.
maintains highly dynamic data on the state of your
operating system.
a new /proc file system is created every time your Linux
machine reboots.
Everything regarding your hardware like bluetooth,
different slots, bus etc. is stored in it.
/USR
/usr is the second major section of the filesystem.
/usr is shareable, read-only data.
Any information that is host-specific or varies with time is
stored elsewhere.
Large software packages must not use a direct
subdirectory under the /usr hierarchy.
REQUIREMENTS OF /USR
/VAR
This is files that are expected to be updated and changed.
This includes:
Administrative and Logging data
Temporary files
Websites
Mail directories
Print spool
/VAR SHARING
Not Shareable:
/var/log, /var/lock, and /var/run.
Shareable:
/var/mail, /var/cache/man, /var/cache/fonts, and
/var/spool/news.
SUBDIRECTORY OF /VAR
SUBDIRECTORY OF /VAR
PERMISSIONS IN FILE SYSTEM
There are 3 basic permissions
Read (r)
Write (w)
Execute (x)
There are 3 basic level of users
Owner
Groups
Others
METHODS FOR PERMISSION
1. Octal method
Eg: chmod 444 [Link]
2. Alphabets
chmod [a/u/g/o +/- r/w/x]
<filename>
Eg: chmod ugo+r-wx [Link]
3. Reference
Eg: chmod –reference=[Link] [Link]
ADVANTAGE OF SOFT LINK IN LINUX FILE SYSTEM
If Root FS become 100% full, we have to create one soft
link that would point to another point mount created with on
same disk ultimately that New Fs(/test) will store data instead
of root
Symbolic links, or "symlinks" work a little like Windows
shortcuts
Symbolic links work on the files and directory
ADVANTAGE OF HARD LINK IN LINUX FILE SYSTEM
There are basically two main limitations with hard links:
Hard links normally require that the link and the file reside
in the same file system.
Only the super user can create a hard link to a directory.
Thus, symbolic links were introduced to get around the
limitations of hard links.