Session 1
Session 1
rA
pt
ec
h
C
en
© Aptech Limited
tre
U
se
O
nl
y
y
nl
• Identify the need for using open source software
O
• Identify how the Linux operating system was originated
se
• Identify the basic principles of Linux
U
• Identify Red Hat operating system distributions
• Describe the features of Red Hat Enterprise Linux 6.0
tre
• Explain how to log on to the Linux system
en
• Explain the root user and shadow passwords
• Explain the Desktop environment and Window’s Managers
• C
Explain the concept of users and groups
h
• Explain the use of some basic and advanced Linux
ec
pt
rA
Fo
O
Is a software program that acts as an interface between a user and a computer.
se
Consists of instructions that are given to the hardware components of the computer
U
to perform specific tasks, such as creating or copying documents and viewing them.
• Examples of operating systems are:
tre
o Linux, Windows XP, Windows 7, Solaris, Mac and UNIX.
en
Derived from the UNIX operating system
C
h
Offers stability, high security, and reliability
ec
O
to freely use the source code and customize it to meet
se
individual requirements.
U
tre
Open source allows users to perform the following tasks:
en
•
• C
Access the source code of the software
Run the software for commercial or personal use
h
ec
O
to end users and is only available in a compiled executable state.
se
• The end users have to purchase the software to use it for personal or
U
commercial purposes.
tre
• Copying or redistributing of the software can be restricted by the
license agreement between the vendor and the end user.
en
• Owned, developed, and distributed by a single vendor to end users
C
who purchase the software for a license fee.
h
• Services, such as upgrades, add-ons, and support are defined by the
ec
se
• Linux operating system by Red Hat
Fedora Linux
• Release cycle of six months
U
Red Hat Enterprise • By Red Hat
Linux (RHEL) • End users have to pay subscription fee for support
tre
• By Novell
Open SuSE
• Contains StarOffice and Word Perfect
en
• Open to both individual and enterprise users
Mandrake Linux
•
• C
Contains complete Microsoft office
Sponsored by Debian community
h
Debian Linux
• Available free of cost
ec
Sendmail
• General purpose Internetwork e-mail routing application
• By Sun Microsystems
Fo
MySQL
• Database application
O
source code of the software to be available for everyone to use
se
and modify.
U
General Public License (GPL)
tre
• Allows users to package and distribute the original or modified source code of
the software only with other GPL licensed software.
en
Lesser General Public License (LGPL)
C
• Allows users to package and redistribute the original or modified source code of
the software only with other LGPL Licensed software.
h
• Also allows the use of proprietary software with LGPL Licensed open source
ec
software.
pt
• Allows distribution of original source code after modification even if it uses some
other software not covered under the BSD license.
Fo
• Also allows the use of proprietary software with BSD covered software.
O
• Was developed on Minimal UNIX (MINIX),
se
a version of UNIX, using GNU Not UNIX’s
U
(GNU) compiler.
tre
• The name Linux was coined by Linus
en
Torvalds in 1991.
• The Linux source code was made available
C
to everyone on the Internet for study and
h
ec
modification.
• Official mascot for Linux is the Linus
pt
rA
Penguin, Tux.
Fo
O
• Does not need to be restarted
periodically
se
• Provides adequate protection
U
against freezing up or slowing
Stability down
tre
• Modular by design
• Multi-user operating system
en
• Large developer base as it is
C
open source and hence bugs are
fixed relatively faster • File system security
h
• Firewall security
ec
Security
• Security Enhanced Linux
rA
(SELinux)
• Discretionary Access Control
Fo
(DAC)
O
Reliability
se
Backward compatibility
U
tre
Simple installation and upgrade process
en
Low cost of ownership
O
Multitasking
se
Virtual memory
U
Shared libraries
tre
POSIX compliance
en
Samba
Network Information Service (NIS)
C
h
Office suites
ec
Licensing
Fo
O
Users are divided into:
se
U
• Red Hat provides the Red Hat Enterprise Linux
product suite for business users.
tre
• Users are required to pay a product fee for the
Business users software.
en
• Changes in the operating system happen in a slow
pace so that there are no frequent updates.
C
h
ec
O
• Red Hat Enterprise Linux Suite
se
Runs on multiple hardware architecture such as IBM PowerPC, AMD64, Intel
EM64T, and Intel x86/x64
U
Operating systems of Red Hat Enterprise Linus suite are:
tre
o Red Hat Enterprise Linux AS
en
o Red Hat Enterprise Linux ES
C
o Red Hat Enterprise Linux WS
h
• Red Hat Desktop
ec
Used for small and medium business groups, supporting a single CPU
pt
Compatibles with Red Hat Enterprise Linux AS, Red Hat Enterprise Linux ES, and
rA
instant messaging
O
General-purpose operating system similar to Windows NT and Macintosh
se
Red Hat sponsored project
U
Can be freely downloaded from Websites
tre
• Red Hat Enterprise Linux versions released so far are:
en
• Red Hat Enterprise Linux 2.1 (Panama)
• C
Red Hat Enterprise Linux 3 (Taroon)
h
ec
• Red Hat Enterprise Linux 4 (Nahant)
•
pt
O
Provides GUI for Linux.
se
Is portable and is a network transparent client/server interface between the
hardware and desktop environment.
U
• Windows Manager customizes the desktop according to the user
tre
requirement and the Desktop Environment is a user interface that
en
runs on the Windows Manager.
• Desktop Environment:
C
Used to create a common graphical user environment by combining
h
ec
various X clients.
The two types of desktop environments provided by Red Hat Enterprise
pt
o Gnome
o KDE
Fo
O
Used to control the working of the desktop
se
Helps in controlling moving, hiding, resizing, iconizing, and closing windows
• The different types of Windows Managers are:
U
kwin:
tre
o Default Window Manager for KDE that supports custom themes
en
metacity:
o Default Window Manager for Gnome that supports custom themes
mwm:
C
o Requires installation of the metacity package
h
ec
o Motif Window Manager is a stand-alone Window Manager
o Requires installation of the open motif package
pt
twm:
rA
o Tab Window Manager can be used as a stand-alone Window Manager as well as with
the desktop environment
Fo
O
use a Linux system. The typing the logout command at the
se
authentication is done through a shell prompt.
login process. • This logs the user out of the system
U
• Log in to the system console is and a new login prompt appears on
tre
through one of the following ways: the terminal.
Text based login
en
GUI based login
• Example:
student@localhost~]$ logout
• For a text based system, a
C
command prompt ending with a $
localhost login:
h
sign is displayed.
ec
• Example:
pt
Password:
Last login: Mon Sep 15 14:
Fo
30: 46
se
The concept of Groups in Linux allow groups of users in an organization to share, read, write,
and execute common files amongst them.
U
tre
Every user and group logging into the system is uniquely identified using unique numerical
identification numbers called userid and groupid.
en
The user who creates the file is called the owner and group owner of the file. Each file is
C
assigned different read, write, and execute permissions for individual users and groups.
h
The access permissions for the file are assigned by the root user or the file owner.
ec
pt
Root user:
rA
Is a special administrative account which has unrestrictive access to all files, devices, and
programs in the system.
Fo
Is also known as the super user and guards the system against accidental damages.
O
in a directory called the home directory.
se
Pathname: /usr/<username> or /home/<username>.
U
• The home directory is decided by the system administrator at the time
tre
of creating a user account, and the details are stored in the file
/etc/passwd.
en
• When a new user is added to the system, a private user group, having
C
the same name as the user name, is create with the same name as the
h
user’s name.
ec
O
the users and Groups option from the Manager’ window to add a new user.
administration menu. This invokes the
se
user manager window.
U
• All the existing users are listed in the
tre
users tab of this window as shown.
en
C
h
ec
pt
rA
Fo
O
with the same name as the user. The user can Manager’ window to add a new group. This
also become a member of other groups. invokes the create new Group window as
se
• The graphical program to manage the groups shown.
can be invoked by selecting the Users and
U
Groups option from the administration menu.
The user manager window, with the existing
tre
groups being listed in the Groups tab, is
displayed as shown.
en
C
h
ec
Adding a Group
pt
rA
Fo
O
• The commands in Linux are case-sensitive and usually in lower case.
se
• The general syntax for a command is:
U
command [options]
tre
• date command: Used to display current system date and time.
Syntax:
en
student localhost ~]$ date [options]
C
• The following code snippet shows the use of date command with
h
different options:
ec
21:36:42
rA
O
the system date and time.
se
• The common options that can be used with the date command are:
U
Option Function
tre
%m Displays month of the year (in digits)
%d Displays day of the month (in digits)
en
%y Displays year (last two digits)
%D C
Displays date as mm/dd/yy
h
ec
%H Displays hour (00 to 23)
%M Displays minutes (00 to 59)
pt
O
Syntax:
se
[student@localhost ~]$ who [options]
U
• The common options available with the who command are:
tre
Option Function
-b Indicated the most recent startup time and date
en
-l Lists any login process
-H C
Displays a header
h
ec
-q Prints only the login names and the number of users
logged in
pt
rA
O
[student@localhost ~]$ who
se
student pts/0 2008-03-26 17:36(:0.0)
U
• The pts in the output denotes a remote terminal. A remote terminal is a
tre
terminal connected from a machine other than the server.
en
• The output of the who command is explained in the following table:
Column# C Description
h
1 Displays a login name
ec
O
Linux operating system.
se
Syntax:
[student@localhost ~]$ man [-] [-k keywords] topic
U
• The arguments to the man command are as follows:
tre
Argument Function
en
- Displays content of the manual without pausing
-k keywords
C
Searches for the keywords specified within the available
h
manuals
ec
O
Syntax:
se
[student@localhost ~]$ ls [options]
U
• The common options available in the ls command are:
tre
Option Function
-a Lists all the files including hidden files
en
-F Displays the file type along with the name
-R
C
Displays the contents of specified directory and sub-directories
h
-r Displays files and sub-directories in the reverse order
ec
se
read permission (r)
For directories it means that the content of the directory can be listed with
U
the ls command.
tre
This means that the file can be modified and saved.
en
write permission (w)
For directories, it means that files can be created in that directory by the
user.
C
This means that files can be executed by the shell when its name is typed at
h
the command prompt.
ec
execute permission (x) For directories, the user has the ability to traverse its tree in order to access
pt
files or subdirectories.
The files cannot be seen until the permission is set.
rA
Fo
O
the –l option with the ls command.
se
[student@localhost ~]$ ls -l
total 2
U
-rw-rw-r-- 1 student student 134 Jun 21 00.18 Desktop
drwxr-xr-x 1 student student 10 Jun 21 13.18 X
tre
• The various column outputs of the ls –l command are:
en
Option Function
1
2 C
Specifies file type and File Access Permissions (FAP)
Specifies symbolic links, that is a file that points to another file
h
ec
O
lists the files in a sorted manner. The following code snippet
se
shows the use of the dir command.
U
tre
[student@localhost ~]$ dir
en
News axhome nsmail search
author.msg documents reading vultures.msg
auto mail research
C
h
ec
pt
rA
Fo
O
presents a long listing by default. The following code snippet
se
demonstrates the use of the vdir command.
U
[[student@localhost ~]$ vdir
tre
total 10
drwxr-xr-x 2 bball bball 1024 Nov 12 08:20 News
en
-rw-rw-r-- 1 bball bball 4766 Nov 12 07:41 author.msg
drwxrwxr-x 2 bball bball 1024 Nov 5 10:04 auto
C
drwxrwxr-x 3 bball bball 1024 Nov 12 13:54 axhome d
h
rwxrwxr-x 2 bball bball 1024 Nov 12 15:13 documents
ec
drwx------ 2 bball bball 1024 Nov 12 14:02 mail
drwx------ 2 bball bball 1024 Sep 15 01:57 nsmail
pt
O
Syntax:
se
[student@localhost ~]$ tree [options]
U
• The common options available with the tree command are:
tre
Option Function
en
-a Displays all files, except the hidden files
-d Lists the directories only
-f C
Displays the full path prefix for each file
h
-p Displays the file permissions for each file
ec
O
se
[student@localhost ~]$ tree
.
U
|-- projects
| |-- current
tre
| `-- old
| |-- 1
en
| `-- 2
`-- trip
`-- schedule.txt
C
4 directories, 3 files [
h
student@localhost ~]$
ec
pt
rA
Fo
O
Create a file
se
Update the file’s modification date
U
Syntax:
[student@localhost ~]$ touch [Options] { File(s)}
tre
• The common options available with the touch command are:
en
Option Function
-a
C
Changes the access time of the file specified. Does not change the
modification time unless –m is also specified.
h
ec
restrictions on a file.
rA
O
• Also used to create, combine, overwrite, or append files.
se
Syntax:
U
[student@localhost ~]$ cat filename [options]
• The common options available with the cat command are:
tre
en
Option Function
-n Precedes each line with a line number
-u C
Does not buffer the output
h
-e Displays a character $ at the end of each line
ec
O
Syntax:
se
[student@localhost ~]$ more [options]
U
• The common options available with the more command are:
tre
Option Function
en
-c Clears and redraws the screen before displaying
-d
C
Displays error message if an unknown command is used
h
-i Performs case insensitive pattern matching in searches
ec
O
• The shutdown command is used to shutdown the Linux operating system.
se
Syntax:
U
[student@localhost ~]$ shutdown [options]
• The common options available with the shutdown command are:
tre
en
Option Function
-h C
Halts after shutdown
h
ec
-r Reboot after shutdown
-c Cancels a pending shutdown
pt
O
• Used to display the amount of space used and the amount of free disk space
se
available on the currently mounted file systems.
U
Syntax:
[student@localhost ~]$ df [option] [File_name]
tre
• The common options available with the df command are:
en
Option Function
-h C
Displays the size in megabytes and gigabytes and appends the
h
data with M and G respectively
ec
O
format.
se
U
[student@localhost ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
tre
/dev/hda2 28G 7.6G 19G 29% /
tmpfs 252M 0 252M 0% /dev/shm
en
/dev/hda1 464M 37M 403M 9% /boot
/dev/hda3 8.3G 429M 7.5G 6% /var
nfs6: /home 520G
C
461G 60G 89% /home
h
ec
pt
rA
Fo
O
running on the Linux system.
se
Syntax:
[student@localhost ~]$ ps [option]
U
• The common options available for the ps command are:
tre
Options Function
en
-f Generates a full listing of all the processes
-A C
Displays information of all processes
h
-a Displays information about all frequently
ec
requested processes
pt
currently running
Options of the ps Command
Fo
O
se
[student@localhost ~]$ ps
PID TTY TIME CMD
U
3511 pts/1 00:00:00
bash 3514 pts/1 00:00:00 ps
tre
en
• The ps command displays the process ID, the terminal associated with the
C
process, the CPU time, and the executable shell name.
h
ec
pt
rA
Fo
O
execution of one process.
se
Syntax:
[student@localhost ~]$ kill [options] [pids]
U
• The common options available for the kill command are:
tre
en
Option Function
-a Kills all the processes having the name specified
-l C
Lists all signals
h
-p Prints the process ID of the named processes
ec
O
Syntax:
se
student@localhost ~]$ uname [options]
U
• The common options available for the uname command are:
tre
Option Function
en
-a Prints all the basic information currently available from the system
-r
-s C
Prints the operating system release level
Prints the operating system name
h
ec
O
system along with the OS release level and the OS version.
se
U
[student@localhost ~]$ uname -arv
Linux localhost.localhostdomain 2.6.18-8.el5 #1 SMP Fri Jan 26
tre
14:14:15 EST 2007
i686 i686 i286 GNU/Linux
en
[student@localhost ~]$
C
h
ec
pt
rA
Fo
O
is used to display the names of these terminals.
se
Syntax:
U
[student@localhost ~]$ tty
tre
/dev/pts/0
en
• The terminal filename is tty01 and is resident in the /dev
directory. C
h
ec
pt
rA
Fo
O
Syntax:
se
[student@localhost ~]$ lpr [options] filename
U
• The common options available with the lpr command are:
tre
Option Function
en
-P destination Name of the printer on which to print
-# number Prints the specified number of copies
-T title C
Prints a title on the banner page of the output
h
ec
-q Holds a job for printing
Options of the lpr Command
pt
• The following code snippet prints 5 copies of the file report.txt on a printer
rA
named accounting.
Fo
O
user name, position in the queue, filenames, job number, and total file
size (in bytes) for each job.
se
Syntax:
U
[student@localhost ~]$ lpq [option] printer
tre
• The common options available with the lpq command are:
en
Option Function
-P destination Displays information about the printer or class of printers
-a C
Reports jobs on all printers
h
ec
-U username Specifies an alternate username for the user
-E Uses encryption to connect to a print server
pt
• The following code snippet displays information about the printer lp0.
Fo
O
Syntax:
se
[student@localhost ~]$ lprm [options]
U
• The common options available with the lprm command are:
tre
Option Function
-P destination Displays information about the printer or class of printers
en
-h server [:port] Specifies an alternate server
-U username C
Specifies an alternate username
h
Options of the lprm Command
ec
O
created.
se
• The & is the shell’s operator used to run a process in the background.
U
• To start a process in the background, terminate the process with an &
tre
symbol as shown in the following code snippet.
en
[student@localhost ~]$ sort file1.txt file2.txt &
[1] 2975
C
h
• The shell immediately returns a number which is the PID of the invoked
ec
command.
pt
O
a user and a computer.
• Linux was developed on Minimal UNIX (MINIX), a UNIX version, using GNU
se
Not UNIX’s (GNU’s) C compiler.
U
• The X Window System is a Graphical User Interface in Linux, which provides
tre
the foundation for Window Managers such as GNOME and KDE.
• When a new user is added to the system, a private user group is automatically
en
created with the same name as the user’s name.
C
• The root user is a special administrative account, that has unrestricted access
h
to all the files, devices, and programs in the system.
ec
• The basic Linux commands include: date, who, man, dir, vdir, tree,
cat, and more commands for reading directories and files command, exit
pt
• The advanced Linux commands include: yydf, ps, kill, uname, tty,
Fo