Elnasr Technical College
Information Technology Department
OPERATING SYSTEM
―LINUX Administration & Networking System‖
By:
Mohamed A. Goumaa
1
March 2016
Schedule
Course Schedule
Lectures : Every Tuesday, 08:00 – 10:00
Labs : Every Tuesday, 10:00 – 12:00 Group A
Every Tuesday, 12:00 – 02:00 Group B
Grading
Grading Guidelines
Attendance: 10%
Course works: 10%
Lab exam: 20%
Final exam: 60%
Minimum 80% attendance to clear the course.
Introduction to Linux
UNIX
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.
Introduction to Linux
History of UNIX
First Version was created in Bell Labs in 1969.
Some of the Bell Labs programmers who had
worked on this project, Ken Thompson, Dennis
Ritchie, Rudd Canaday, and Doug McIlroy
designed and implemented the first version of the
Unix File System on a PDP-7 along with a few
utilities. It was given the name UNIX by Brian
Kernighan.
[Link] Hours, Jan 1, 1970 is time zero for UNIX. It
is also called as epoch.
Introduction to Linux
History of UNIX
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.
Introduction to Linux
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). This later developed
into UnixWare and Solaris 2.
1991 Linux was originated.
Introduction to Linux
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.
The Kernel version 1.0 was released in 1994 and
today the most recent stable version is 2.6.9
Developed under the GNU General Public License ,
the source code for Linux is freely available to
everyone.
Introduction to Linux
LINUX Distributions
Mandrake: [Link]
RedHat: [Link]
Fedora: [Link]
SuSE/Novell: [Link]
Debian: [Link]
Red Hat Enterprise Linux is a Enterprise targeted
Operating System. It based on mature Open
Source technology and available at a cost with one
year Red Hat Network subscription for upgrade
and support contract.
Introduction to Linux
Linux Pros and Cons
Advantages over Windows
– It's almost free to relatively inexpensive
– Source code is included
– Bugs are fixed quickly and help is readily available through the vast
support in Internet
– Linux is more stable than Windows
– Linux is truly multi-user and multi-tasking
– multiuser: OS that can simultaneously serve a number of users
– multitasking: OS that can simultaneously execute a number of
programs.
Introduction to Linux
Linux Pros and Cons (Cont.)
Disadvantages compared with Windows
– Windows program cannot run on Linux
– Isn't as popular as Windows
– No one commercial company is responsible for Linux
Hence currently, Linux is mainly used in
commercial applications, server implementation
More than 75% current network servers are
developed based on Linux or Unix systems
– Due to the relatively high reliability
Introduction to Linux
Linux Structure
Introduction to Linux
Linux Structure
Applications: Compilers, word processors, X-based GUI
AUI
LINUX Shell: Bourne Again (bash), TC, Z, etc.
Language libraries
API
System call interface
Memory File management Process
management Management
Kernel
Device Drives
BIOS
Computer Hardware
Introduction to Linux
Linux Structure
Kernel
– The part of an OS where the real work is done
System call interface
– Comprise a set of functions (often known as API) that can be used by
the applications and library routines to use the services provided by the
kernel
Application User’s Interface
– Interface between the kernel and user
– Allow user to make commands to the system
– Divided into text based and graphical based
Introduction to Linux
Linux Structure
File Management
– Control the creation, removal of files and provide directory maintenance
– For a multiuser system, every user should have its own right to access
files and directories
Introduction to Linux
Linux Structure
Process Management
– For a multitask system, multiple programs can be executed
simultaneously in the system
– When a program starts to execute, it becomes a process
– The same program executing at two different times will become two
different processes
– Kernel manages processes in terms of creating, suspending, and
terminating them
– A process is protected from other processes and can communicate with
the others
Introduction to Linux
Linux Structure
Memory Management
– Memory in a computer is divided into main memory (RAM) and secondary
storage (usually refer to hard disk)
– Memory is small in capacity but fast in speed, and hard disk is vice versa
– Data that are not currently used should be saved to hard disk first, while dat
that are urgently needed should be retrieved and stored in RAM
– The mechanism is referred as memory management
Device drivers
– Interfaces between the kernel and the BIOS
– Different device has different driver
Introduction to Linux
Linux User Login
Linux is a multiuser OS
Allow multiple users to use the resource of a computer at the same time
Every user needs to login the system with the password provided to identify
their right in using the resource
Require for both client-server based system or desktop
Linux
Paul
Server Mary
Peter
Peter: admin
Paul : general
Mary : intruder Client-server based
: system
Introduction to Linux
Linux User Interface
• Traditional Linux (Unix also) uses command-driven
interface (or text-based interface)
– User needs to type lines of command to instruct the
computer to work, similar to DOS
– Advantage: fast in speed. Very few resource is
required for its implementation
– Disadvantages: user needs to type, hence can
easily make error. Besides, user needs to memorize
all commands.
– Suitable for expert users and for the systems that
interaction with user is not frequent, such as servers
Introduction to Linux
Linux User Interface
By adopting the X-Window technology, graphical user
interface (GUI) is available for Linux:
– Uses pointing devices (e.g. mouse) to control the system,
similar to Microsoft’s Windows
– Provide menu-driven and/or icon-driven interfaces
– menu-driven: user is provided with a menu of choices.
Each choice refers to a particular task
– icon-driven: tasks are represented by pictures (icon) and
shown to user. Click on an icon invokes one task
– Advantages: No need to memorize commands. Always
select task from menus or icons
– Disadvantages: Slow and require certain resource for its
implementation
– Suitable for general users and systems, such as PC
Introduction to Linux
Linux User Interface
Linux Shell whoami
Shell interprets the command ls pwd
and request service from Bash, Tcsh, Zsh
kernel
Similar to DOS but DOS has Kernel
only one set of interface while
Linux can select different shell
– Bourne Again shell (Bash), TC
shell (Tcsh), Z shell (Zsh)
Differentshell has similar but different functionality
Bash is the default for Linux
Graphical user interface of Linux is in fact an application
program work on the shell
Introduction to Linux
Linux User Interface
Frequently used commands available in most shells:
– ls : to show the names of the file in the current directory
– cd : change directory,
– e.g. cd / change to the root directory
cd .. change to the parent of that directory
– cp : copy one file to another
– e.g. cp [Link] [Link] copy [Link] to [Link]
– rm : remove a file
– man : ask for the manual (or help) of a command
– e.g. man cd ask for the manual of the command cd
– pwd : show the name of the current directory
– cat : to show the content of a text file
– e.g. cat [Link] show the content of [Link]
– whoami : to show the username of the current user
Introduction to Linux
Linux File Management
In Linux, file is defined as simply the thing that
deals with a sequence of bytes
Hence everything are files
– An ordinary file is a file; a directory is also file; a network
card, a hard disk, any device are also files since they
deal with a sequence of bytes
Linux supports five types of files
– simple/ordinary file (text file, c++ file, etc)
– directory
– symbolic (soft) link
– special file (device)
– named pipe (FIFO)
Introduction to Linux
Linux File Management
The concept of simple file and
directory is similar to DOS
Names in blue are directories, indicated by a
letter d at the beginning of the line
Introduction to Linux
Linux File Management
Symbolic (soft) link
– Not a real file, just a link to another file
– Allow giving another name to a file without actually
duplicates it – hence save memory space
Special file (device)
– Each hardware device, e.g. keyboard, hard disk, CD-
ROM, etc is associated with at least one file
– Usually store in /dev directory
– Applications can read and write any devices by reading
and writing their associate file – hence the access
method is known as device independent
– Divide into two types: character special files, e.g.
keyboard, and block special files, e.g. disk
Introduction to Linux
Linux File Management
Command that sets a symbolic
link to a file called CUI to
anotherCUI
File size is only 6 bytes
A symbolic link begins with a letter l `
Introduction to Linux
Linux File Management
Some are Some of the special device files in /dev
character devices, fd0 – floppy disk
hence start with a md0 – CD-Rom
letter c Both of them are block devices, hence start with a
letter b
Introduction to Linux
Linux File System Structure
According to the File System Standard (FSSTND)
proposed in 1994, every LINUX system should
contain a set of standard files and directories
Introduction to Linux
File System
The Unix file system looks like an inverted tree
structure.
You start with the root directory, denoted by /, at
the top and work down through sub-directories
underneath it.
Introduction to Linux
File System
Each node is either a file or a directory of files,
where the latter can contain other files and
directories.
You specify a file or directory by its path name,
either the full, or absolute, path name or the one
relative to a location.
The full path name starts with the root, /, and
follows the branches of the file system, each
separated by /, until you reach the desired file, e.g.:
/home/condron/source/xntp
Introduction to Linux
Structure of Standard Directories
in Unix/Linux
/ ―Root directory‖ The ancestor of all directories on
the system; all other directories are subdirectories of
this directory, either directly or through other
subdirectories.
/bin
Contain the binary (executable code) of most
essential Linux commands, e.g. bash, cat, cp, ln, ls,
etc.
/dev Files representing the system's various hardware
devices. For example, you use the file `/dev/cdrom' to
access the CD−ROM drive.
/etc Miscellaneous system configuration files, startup
files, etc.
Introduction to Linux
Structure of Standard Directories
in Unix/Linux
/home
Contain the home directories of every user in the
system, e.g. dlun, guest, etc
/lib
Store all essential libraries for different language
compilers
/proc Files that give information about current system
processes.
/root The superuser's home directory, whose
username is root. (In the past, the home directory for
the superuser was simply `/'; later, `/root' was adopted
for this purpose to reduce clutter in `/'.)
Introduction to Linux
Structure of Standard Directories
in Unix/Linux
/sbin Essential system administrator tools, or system
binaries.
/tmp Temporary files.
/usr Subdirectories with files related to user tools and
applications.
Introduction to Linux
Directories, Files and Inodes
Every directory and file is listed in its parent
directory.
In the case of the root directory, that parent is itself.
A directory is a file that contains a table listing the
files contained within it, giving file names to the
inode numbers in the list.
The information about all the files and directories is
maintained in INODE TABLE
An Inode (Index Nodes) is an entry in the table
containing information about a file (metadata)
including file permissions, UID, GID, size, time
stamp, pointers to files data blocks on the disk etc.
Introduction to Linux
Users, Groups and Access
Permissions
In UNIX/LINUX, there is a concept of user and an
associated group
The system determines whether or not a user or
group can access a file or program based on the
permissions assigned to them.
Apart from all the users, there is a special user
called Super User or the root which has permission
to access any file and directory
Introduction to Linux
Access Permissions
There are three permissions for any file, directory
or application program.
The following lists the symbols used to denote
each, along with a brief description:
r — Indicates that a given category of user can
read a file.
w — Indicates that a given category of user can
write to a file.
x — Indicates that a given category of user can
execute the file.
Introduction to Linux
Access Permissions
The file access permission can be seen by
using the command ls –l or ls -al
Introduction to Linux
Access Permissions
Each of the three permissions are assigned to
three defined categories of users.
The categories are:
owner — The owner of the file or
application.
group — The group that owns the file or
application.
others — All users with access to the
system.
Introduction to Linux
Access Permissions
One can easily view the permissions for a file by
invoking a long format listing using the command
ls -l.
For instance, if the user juan creates an executable
file named test, the output of the command ls -l test
would look like this:
-rwxrwxr-x 1 juan student 0 Sep 26 12:25 test
Introduction to Linux
Access Permissions
Introduction to Linux
Access Permissions
The permissions for this file are listed are listed at
the start of the line, starting with rwx.
This first set of symbols define owner access.
The next set of rwx symbols define group access
The last set of symbols defining access permitted
for all other users.
Introduction to Linux
Access Permissions
This listing indicates that the file is readable,
writable, and executable by the user who owns the
file (user juan) as well as the group owning the file
(which is a group named student).
The file is also world-readable and world-
executable, but not world-writable.
Introduction to Linux
Listing the Content of a Directory
ls is used to list the contents of a directory.
If the command ls is written with parameter –l then
the command lists contents of the working
directory with details. Example:
$ ls –l
Introduction to Linux
Access Permission of File/Directory
Access permission can also be assigned to a
directory
Directory is also a file that contains the
attributes of the files inside it
If read permission is not given to a directory
– cannot show the structure of this directory
– e.g. cannot use ls
Introduction to Linux
Access Permission of File/Directory
If write permission is not given to a directory
– cannot modify anything of the directory structure
– e.g. cannot copy a file into this directory since it will
modify the directory structure by adding one more
file
If execute permission is not given to a directory
– nearly nothing can be done with this directory, even
cd
Introduction to Linux
Access Permission of
File/Directory
The #'s can be:
0 = Nothing
1 = Execute
2 = Write
3 = Execute & Write (2 + 1)
4 = Read
5 = Execute & Read (4 + 1)
6 = Read & Write (4 + 2)
7 = Execute & Read & Write (4 + 2 + 1)
Introduction to Linux
Access Permission of File/Directory
The access permission of a file or directory can
be changed by using the command
chmod xyz filename/directory name
xyz refers 3 digit in octal form
E.g.
660 : 110 110 000
rw- rw- ---
545 : 101 100 101
r-x r-- r-x
Introduction to Linux
Access Permission of File/Directory
temp does not have execution right
even cd is not workable
execution right is added
now we can change the directory to temp