linux slides1 to 800
TRANSCRIPT
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 1/798
index
Units:
unit-1 About the founder of Linux.unit-2 Linux VS Windows.
unit-3 Linux Flavors.
unit-4 Introduction to Redhat Linux.
unit-5 Kernel.
unit-6 Types of shells
unit-7 Dos Vs Linux.
unit-8 Redhat Linux Installationunit-9 Hardware Requirements
unit-10 Installation Methods
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 2/798
Unit -1
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 3/798
About the founder of LINUX
•Linus Benedict Torvalds (bornDecember 28, 1969) began the
development of Linux, an operatingsystem kernel, and today acts as theproject coordinator.
•Inspired by Minix (a kernel andoperating system developed by AndrewTanenbaum), he felt the need for acapable UNIX operating system that hecould run on his home PC.
•Torvalds did the original developmentof the Linux kernel primarily in his owntime and on his equipment.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 4/798
•Torvalds originally used Minix on hiscomputer, a simplified kernel written
by Andrew Tanenbaum for teachingoperating system design.
•The Linux system quickly surpassedMinix in functionality.
•The first version of the Linux kernel
was released to the Internet inSeptember 1991. with the secondversion following shortly thereafter inOctober
Evolution of Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 5/798
•Penguin is the official mascot of the Linux operating system.
•Tux, is a chubby penguin that
looks content and satisfied.
•The concept of the Linux mascotbeing a penguin came from LinusTorvalds, the creator of the Linuxkernel.
TUX - the penguin
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 6/798
GNU’s (Not Unix)
• The GNU project was started in 1983 for developing a completeUnix-like operating system, including software development
tools and user application programs, entirely of free software.
• By the release of the first version of the Linux kernel, the GNU
project had produced all the necessary components of this
system except the kernel.
• Torvalds and other early Linux-kernel developers adapted their
kernel to work with the GNU components and user space
programs to create a fully functional operating system.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 7/798
FEATURES OF LINUX
• Open source development model.
• Supports wide variety of hardware.
• Supports many networking protocols and configurations
• Supports more File systems.
• Linux has a reputation for fewer bugs (programming
mistakes) than Windows.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 8/798
Linux Vs Windows
Open Source Development Modeland so the programmer can redesignthe OS.
It is not an open source and hencecannot be redesigned by theprogrammer.
Linux is robust and very much securefrom virus.
Windows gets affected by virus veryeasily.
The Linux servers has surpassedwindows server operating system insecurity.
Security is the main issue which hasmade windows to think to survive.
It costs less to design and implementa Linux Network.
It costs more to implement WindowsNetwork administration, whencompared to Linux.
There are 250000+ developers behindLinux for open source deployment.
Compared to Linux, windows isdeveloped by few thousands of people.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 9/798
Linux Flavors
• Red Hat Linux (Red Hat)
• Fedora Linux
• Open Linux (Caldera)
• SuSE Linux (Novell)
• Mandrake Linux (Mandrake)
• Turbo Linux (Pacific Hi-Tech)
• Linux PPC (MAC Power PC version)
• Info magic
• Slack ware Linux Project
• Knoppix (Live CD) etc.,
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 10/798
Introduction to Red Hat Linux
• Red Hat has split its Linux development into two lines :
• Red Hat Enterprise Linux and
• The Fedora Project.
• Red Hat EL features commercial enterprise products
for servers and workstations, with controlled releases
issued every two years.
• The Fedora project is an open source initiative whose
Fedora Core release will be issued every six months.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 11/798
Kernel
• The kernel is the essential center of a computer operating system, the core that provides basic services
for all other parts of the operating system.
• A kernel can be contrasted (compared) with a shell,shell is the outermost part of an operating system thatinteracts with user commands.
• Kernel and shell are terms used more frequently in Unixoperating systems than in IBM mainframe or MicrosoftWindows systems.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 12/798
• Bash shell (Bourne again Shell)
– Developed for the GNU Project
– The actual standard Linux shell
– Default shell for Red Hat Linux
• Borne shell (sh) – Original Unix shell written by Bill
Joy at UC Berkeley
• C shell (csh)
– Added many features such as command, history
and job control
Continue…
Shells
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 13/798
• Korn Shell (Ksh) – Written by David Korn
• Implemented many csh features such as command
completion and history
• The Enhanced C shell (tcsh) –a community effort
• More features like command-line editing and more
sophisticated completion
Shells
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 14/798
command
prompt for bash
shell
Type bash and
hit enter
Shells
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 15/798
command
prompt for c-
shell (csh)
Shells
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 16/798
command prompt
for enhanced C
shell (tcsh)
Shells
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 17/798
command
prompt for
bourne shell(sh)
Shells
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 18/798
commandprompt for korne
shell (ksh)
Shells
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 19/798
DOS Vs LinuxDOS
Command
LINUX Command Action
DIR ls -l List directory contents
TREE ls –R List directory
recursively
CD cd Change directory
MKDIR mkdir Make a new directory
RMDIR rmdir Remove a directory
CHDIR pwd Display directory
location
DEL rm Remove a file
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 20/798
DOS Command LINUXCommand
Action
RMDIR /S (NT)DELTREE (Win95...)
rm -r Remove all directories and files belowgiven directory
COPY cp Copy a file
XCOPY cp -r Copy all file of directory recursively
RENAME or MOVE
mv Rename/move a file
TYPE cat Dump contents of a file to users screen
MORE more Pipe output a single page at a time
HELP or COMMAND /?
man Online manuals
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 21/798
DOSCommand
LINUXCommand
Action
CLS clear Clear screen
EXIT exit Exit a shell
FIND find Look for a word in files given in command line
FC diff Compare two files and show differences. Also seemgdiff and tkdiff.
SET set and env Show environment variables
ECHO text echo text Echo text to screen
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 22/798
DOSCommand
LINIUX Command Action
SETvariable export variable name Set environment variables
PATH echo $PATH Display search path for executables
DATE or TIME
date Show date. (also set date -DOS only)
SORT sort Sort dataalphabetically/numerically
EDITfilename.txt vim
Edit a file. The Linux editor which looks most like DOSedit is probably Pico.
\ / Directory path delimiter
.\ ./ Current directory
..\ ../ Parent directory
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 23/798
DOS Command LINUX Command Action
BACKUP files A:\ tar -cvf /dev/fd0files
Save backup files to floppy
RESTORE A:\ filestar -xvf /dev/fd0files
Read files from floppy.See Using DOS floppies
ATTRIB +h or -h mv file .file Change file to a hidden file - renamefile with prefix "."
PRINT lpr Print a file
MEMfreetop
Show free memory on system
MSD lsdevShow system info (Commandborrowed from AIX)
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 24/798
DOS Command LINUX Command Action
SCANDISKDEFRAG C:
fsck Check and repair hard drive file system
FDISK fdisk Tool to partition a hard drive.
FORMATmke2fsSee: fdformat for floppy
Format drive file system.For floppy drive use see YoLinux TutorialUsing DOS Floppies with Linux
VER uname -a Operating system version
pkziptar, gzip andbzip2
Compress and uncompressfiles/directories. Use tar to create Linuxalso has compress, gzip
HOSTNAME hostname Print host name of computer
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 25/798
DOS CommandLINUXCommand
Action
PING ping Send packets to a network host
TRACERT tracerouteShow routes and router hops togiven network destination.
IPCONFIG (NT)WINIPCFG (Win 95...)
ifconfig Display/configure network interface
NBTSTAT (Netbios info:
-n, -c)NBTSTAT -a host-name NBTSTAT -A IP-address
nslookup host-name Print DNS info for host.
ROUTE PRINT route -n Print routing table.
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 26/798
DOS CommandLINUXCommand
Action
PING ping Send packets to a network host
TRACERT tracerouteShow routes and router hops togiven network destination.
IPCONFIG (NT)WINIPCFG (Win 95...)
ifconfig Display/configure network interface
NBTSTAT (Netbios info:-n, -c)
NBTSTAT -a host-name NBTSTAT -A IP-address
nslookup host-
namePrint DNS info for host.
ROUTE PRINT route -n Print routing table.
Network Commands
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 27/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 28/798
Hardware Requirement
32-bit Intel based processor, atleast an Intel or compatible 80386,
80486, or Pentium-classmicroprocessor is required.
400 MHz Pentium is recommendedfor a graphical interface and 200
MHz for text.
Normally 64MB RAM for Text, and192 MB for graphical. (Linux canrun on as little as 12 MB RAM).
At least 2GB free hard disk spacefor a standard installation, includingapplications; 3 to 6 GB or more isrecommended for a full installation(all applications).
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 29/798
Installation Methods
Red Hat Installation CD-ROM.
NFS Image.
Kick Start
FTP
HTTP
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 30/798
• To boot from a CD-Rom or DVD-Rom, you may first
have to change the boot sequence setting in your
computer’s BIOS so that the computer will try to boot
first from the CD-Rom.
Red Hat Installation through CD
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 31/798
NFS Image
• NFS (Network File Sharing): It is a common method
to share files.
• An image of an operating system is taken already
which is connected remotely to install the image in a
system.
• The image system is first mounted and operating
system path is given to get into the installation.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 32/798
Kick Start Installation
• Till now we have seen attended installation, where the user have to interact with the system.
• The kick start installation is known as unattended
installation where the user appearance is not necessary.• The system will automatically install the operating system
into the machine including the device installation, hard disk
partition, assigning of ip address etc.,
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 33/798
Red Hat Installation
Press Enter, toinstall in
Graphical mode.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 34/798
Type linuxtext, to installin Text mode.
Red Hat Installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 35/798
Type linux askto install either tFTP, HTTP, Ha
and NFS.
Red Hat Installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 36/798
Red Hat Installation
Type linux textaskmethod to installeither through FTP,
HTTP, Hard disk andNFS.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 37/798
Installation Setup Screen
Type Linux Text and
press enter for Text
mode Installation
The InstallationMode is selected here
Just press enter
for graphical
mode Installation.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 38/798
Hardwaredetection
process
Hardware Detection
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 39/798
Select theInstallationlanguage.
R dh t I t ll ti
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 40/798
Redhat Installations
Select the typeof keyboard
layout.
R dh t I t ll ti
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 41/798
Select theappropriate
type of
installation.
Redhat Installations
R dh t I t ll ti
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 42/798
Select theappropriateNFS type
installation.
Redhat Installations
R dh t I t ll ti
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 43/798
Select thisoption to assignan dynamic ip
address.
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 44/798
Enter theappropriate ip
address
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 45/798
Enter theinformation of
server ip addressand directory.
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 46/798
The Anaconda-Red Hat
Installer begins
the Installation.
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 47/798
Hardwaredetection
process
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 48/798
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 49/798
The Red Hat LinuxWelcomes
you.
Redhat Installations
S l h P i i i T
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 50/798
Select the Partitioning Type
Select this for simpler automatic
partitioning.
Click here for manualpartitioning. Raid and LVM
also can be configured(Disk Druid tool can be
used only while installation)
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 51/798
Click here tocreate new
partition in thefree space
Redhat Installations
Creating Partition for /boot directory
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 52/798
Enter themount pointshere.( /boot )
Select the file systemtype here.( ext2, ext3for normal partitionand swap for swap
partition)
Enter the sizeof the
partitionshere.
Creating Partition for /boot directory
Creating Partition for / directory
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 53/798
Enter themount points
here.( / )
Select the file systemtype here.( ext2, ext3
for normal partition andswap for swap
partition)
Enter the sizeof the
partitions here.
Creating Partition for / directory
Creating Partition for swap directory
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 54/798
Enter themount pointshere.(swap)
Enter the sizeof the
partitions here.
Creating Partition for swap directory
R dh I ll i
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 55/798
The final viewall the
mounting
point.
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 56/798
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 57/798
eth0 means firstEthernet card its
address gettingfrom DHCP.
Hostnamealso gettingfrom DHCP
server..
Redhat Installations
Fi ll C fi tiFi ll C fi ti
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 58/798
Firewall Configuration
No firewall optionallows all networkservices to your
machine
Firewall Configuration
No firewall optionallows all networkservices to your
machine
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 59/798
Enable firewalloption allows
specific networkservices to your
machine
Activate your SELINUX options
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 60/798
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 61/798
Choose thedefault language
for the system.
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 62/798
Time zone isselected here.
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 63/798
Enter the
password for theroot (Super User)
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 64/798
Its readingpackage
information's.
Redhat Installations
Redhat Installations
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 65/798
Select customizeoptions to customize
the package selections
This is used to selectthe default package.
Redhat Installations
Package Selection
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 66/798
Package Selection
The Packages to beinstalled are selectedhere. Even the office
(Like MS-Officein windows)
Packages areavailable inbuilt
in Red Hatinstallation CD
Package Selection
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 67/798
Package Selection
Checking andinstalling thepackages.
Beginning of Installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 68/798
Click next to beginthe actual installationwhich begins writing
the operating systemin the hard drives.
Beginning of Installation
Installing Packages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 69/798
Creating the file
system in theinstallationpartition.
Installing Packages
Installing Packages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 70/798
The installationimage is copiedto the hard drive.
Installing Packages
Installing Packages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 71/798
Initializing theinstallation
process
Installing Packages
Installing Packages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 72/798
Preparing for theinstallation
process
Installing Packages
Installing Packages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 73/798
Installation of packages under
progress
Installation of tzdata packages
Installing Packages
Installing Packages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 74/798
Installation of packages under
progress
Installing Packages
Installing Packages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 75/798
Installation of packages under
progress
s a g ac ages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 76/798
Installation of packages under
progress
Installing Packages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 77/798
Installing Packages
Installation of packages under
progress
Installing Packages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 78/798
Installation of packages under
progress
g g
Installing Packages
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 79/798
Performing thepost install
configuration.
Installing Packages
Reboot the System
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 80/798
The Red Hat Installation iscompleted successfully.Remove any Installation
media and boot disks.And reboot the system.
y
Rebooting
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 81/798
g
GRUB boot loader
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 82/798
Highlight the operatingsystem and press enter
to boot.
Loading Kernel
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 83/798
g
Initializing hardware devices
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 84/798
g
Initializing services
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 85/798
g
Welcome to Red Hat Setup
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 86/798
p
The Red Hatsetup agentwill proceed
someMore basic
configurationsBefore the system
is readyto use.
WelcometoRed Hat Linux
Setup agent
License agreement
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 87/798
Setting date and time
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 88/798
Graphics configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 89/798
Select the Colour depth-the number of distinct
colours requiredsupporting the video
card Installed
Select the screen
resolution suiting your monitor and display
card
p g
Red Hat Login
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 90/798
To register the systemto Red Hat enter the
Login name andpassword.
Red Hat Login
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 91/798
If you don’t have redhatlogin select this optionto create a new login.
Red Hat Login
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 92/798
Enter this optionto know the
details
Red Hat Login
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 93/798
Click here toskip registration
Click here toregister with theRed Hat network
The update agentregisters the
machine withRed Hat networkSo that the latest
Software packagesGet updatedautomatically
System user creation.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 94/798
Create nonadministrative user toaccess the system.
Sound Card Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 95/798
Sound gettingConfigured
automatically
Tests sounds for the 3channels in sound card
can be heard byselecting play test sound
To Install additional softwares
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 96/798
Click here to install
any additional
software.
Finishing Setup
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 97/798
The Red Hatsetup agent
Finishes the setup
Login Screen
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 98/798
Login Screen
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 99/798
Red Hat supportsmany languages,the language can
be selected beforelogin.
Login Screen
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 100/798
The kind of desktop
can be selectedhere.
Login Screen
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 101/798
The system canbe rebooted using
the option.
Login Screen
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 102/798
The system canbe restarted using
the option.
Login Screen
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 103/798
Enter the user Name
Login Screen
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 104/798
Enter the user Password.
Loading the user settings.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 105/798
Red Hat Startup Screen
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 106/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 107/798
Now the Red Hat
Linuxis ready for use.
Kernel initialization
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 108/798
• As systems boots, kernel get initialized and thefollowing functions are occurred.
• Device detection: kernel will compile the device
drivers and locate it to the corresponding devices.
• Mounts root file system: After the device detectionthe kernel will mount the root file system as readonly.
• Load initial process: The very first process (init) isthen loaded.
Initial process
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 109/798
• Init :
• It is the superior of all processes.
• As soon as init process is loaded the control is
passed from kernel to this process.
• /etc/inittab:
• File which contains the information on how initshould setup the system in every run level, as well
as the run level to use a default.
Run levels
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 110/798
init 0 : Shutdown the system or halt
init 1 : Single-user mode.
init 2 : Multi-user mode with out networking support.
init 3 : Multi-user mode with networking support.
init 4 : Unused.
init 5 : Graphical user interface.
init 6 : Reboot the system.
Run level configuration file
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 111/798
Get in to theinittab file, the
init configurationfile.
Run level configuration file
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 112/798
The defaultrun level canbe changed
here.
CONSOLES
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 113/798
• Text-mode login at virtual console
• Multiple non-GUI logins are possible
• Default consoles are in text mode
• Available through CTRL-ALT-F[1-6]
• Graphical login• Graphical console comes through CTRL-ALT-F7
X Window System
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 114/798
• It is the foundation for the graphical user Interface of
Red Hat Linux.
• X applications communicate with a display via. The X
protocol.
• X is OS Independent.
• It is available on many platforms.
X Protocol
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 115/798
• It hides the individual details of the OS and the underlying hardware.
• X protocol is a asynchronous network protocol for the communication
between X client and X Server.
• It defines how the graphical primitives are communicated between X client
and server.
Multiple Desktop Environments
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 116/798
• The X Window System of Red Hat provides two Desktop
Environments.
• GNOME (GNU Network Object Modules Environment).
• KDE (K desktop Environment).
GNOME
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 117/798
• It is the default desktop environment for Red Hat
Linux.
• It is Power full and easy-to-use desktop environment
consisting primarily of a panel and a set of GUI tools.
• GNOME is free and hence its source code can be
downloaded form the GNOME Web Site:
www.gnome.org.
GNOME Interface
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 118/798
• The GNOME Interface consists of a Panel and a Desktop.
• Panel appears as a long bar across the bottom of screen.
• Panel holds Menus, Programs and Applets.
• The Remainder Screen is the Desktop. Here you can place
directories, files or programs.
GNOME Desktop
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 119/798
GNOME Menus
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 120/798
GNOME Menus
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 121/798
KDE
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 122/798
• KDE provides an alternative desktop environment with full
set of integrated network and internet applications.
• Along with GNOME features, It also includes
• Konsole : Highly configurable graphical terminal.
• Konqueror : A file manager and web browser.
• Kmail : A graphical email client.
• Kdevelop : Integrated development.
KDE Desktop
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 123/798
KDE Desktop
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 124/798
KDE Desktop
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 125/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 126/798
Starting X Window
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 127/798
The X window start automatically, If so then a
Graphical login screen is prompted by the Display
manager.
Alternatively use startx to get in to X window from
non-windowing console.
Start X
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 128/798
To get in to Xwindow from run
level-3
Start X
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 129/798
Desktop Selection
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 130/798
To get in to the previously used
desktop
Select failsafe
in case of anygraphical
failure
To get the
default
desktop.To get in to
GNOME
desktop.
To get in to
KDE desktop.
KDE MODE
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 131/798
If you click yes theKDE desktop is set
as default desktopfor future sessions(or) login
If you click No, onlythe current sessionis set to KDE.
Switchdesk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 132/798
To change thedesktop environment.
Switchdesk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 133/798
To switch from kdeto gnome desktop
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 134/798
Linux File System Directories
Directory Function
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 135/798
/ Begins the file system structure – called the root./boot Hold the kernel image files and associated boot
information and files.
/home Contains user’s home directories.
/sbin Holds administration-level commands and anycommands used by the root user.
/dev Holds file interface for devices such as the terminaland the printer.
/etc Holds system configuration files and any other system files.
/etc/opt Holds system configuration files for application in/opt
y
Linux File System Directories
Directory Function
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 136/798
/etc/X11 Holds system configuration files for the X WindowSystem and its applications.
/bin Holds the essential user commands and utilityprograms.
/lib Holds essential shared libraries and kernel modules.
/lib/modules Holds the kernel modules.
/mnt Used to hold directories for mounting file systems
like CD-ROMs or floppy disks that are mounted onlytemporarily.
/opt Holds added software applications (for example,KDE on some distributions).
y
Directory Function
Linux File System Directories
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 137/798
/proc Process directory, a memory-resident directorycontaining files used to provide information aboutthe system.
/tmp Holds temporary files.
/usr Holds those files and commands used by thesystem; this directory breaks down into severalsubdirectories.
/var Holds files that vary, such as mailbox and FTP files.
y
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 138/798
Linux Commands
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 139/798
• Commands have the following syntax:
• Command [options] [arguments]
• Each item is separated by space
• Options modify the command’s behavior
• Arguments are filenames or other information
needed by the command
• Separate commands with semicolon (;)
DOS Vs LinuxDOS LINUX Command Action
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 140/798
Command
DIR ls -l List directory contents
TREE ls –R List directory recursivly
CD cd Change directory
MKDIR mkdir Make a new directory
RMDIR rmdir Remove a directory
CHDIR pwd Display directory
location
DEL rm Remove a file
DOS Command LINUX Action
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 141/798
Command
RMDIR /S (NT)
DELTREE (Win95...)
rm -r
Remove all directories and files below
given directory
COPY cp Copy a file
XCOPY cp -r Copy all file of directory recursively
RENAME or MOVE
mv Rename/move a file
TYPE cat Dump contents of a file to users screen
MORE more Pipe output a single page at a time
HELP or COMMAND/?
man Online manuals
DOSCommand
LINUXCommand
Action
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 142/798
Command Command
CLS clear Clear screen
EXIT exit Exit a shell
FIND grep Look for a word in files given in command line
FC diff Compare two files and show differences. Also seemgdiff and tkdiff.
SET set and env Show environment variables
ECHO text echo text Echo text to screen
DOSCommand
LINIUX Command Action
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 143/798
Command
SET
variable
export variable nameSet environment variables
PATH echo $PATH Display search path for executables
DATE or TIME
date Show date. (also set date -DOS only)
SORT sort Sort dataalphabetically/numerically
EDITfilename.txt vim
Edit a file. The Linux editor which looks most like DOSedit is probably Pico.
\ / Directory path delimiter
.\ ./ Current directory
..\ ../ Parent directory
DOS Command LINUX Command Action
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 144/798
BACKUP files A:\
tar -cvf /dev/fd0
files
Save backup files to floppy
RESTORE A:\ filestar -xvf /dev/fd0files
Read files from floppy.See Using DOS floppies
ATTRIB +h or -h mv file .file Change file to a hidden file - renamefile with prefix "."
PRINT lpr Print a file
MEM freetop Show free memory on system
MSD lsdevShow system info (Commandborrowed from AIX)
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 145/798
DOS CommandLINUXC d
Action
DOS Vs Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 146/798
DOS CommandCommand
Action
PING ping Send packets to a network host
TRACERT tracerouteShow routes and router hops togiven network destination.
IPCONFIG (NT)WINIPCFG (Win 95...)
ifconfig Display/configure network interface
NBTSTAT (Netbios info:-n, -c)
NBTSTAT -a host-name NBTSTAT -A IP-address
nslookup host-
name
Print DNS info for host.
ROUTE PRINT route -n Print routing table.
DOS Command
LINUXCommand
Action
Network Commands
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 147/798
Command
PING ping Send packets to a network host
TRACERT tracerouteShow routes and router hops togiven network destination.
IPCONFIG (NT)WINIPCFG (Win 95...)
ifconfig Display/configure network interface
NBTSTAT (Netbios info:-n, -c)NBTSTAT -a host-name
NBTSTAT -A IP-address
nslookup host-
namePrint DNS info for host.
ROUTE PRINT route -n Print routing table.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 148/798
Login screen
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 149/798
Enter the
user name
PWD
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 150/798
• PWD
• Present working Directory
• Display the absolute path of the current directory.
PWD
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 151/798
The absolute path of the
root directory
is displayed.
lsls :
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 152/798
List the Files and Directories within the current directory.
Syntax:
ls [options]
Options:
-l List file with permission.
-a List hidden file.
-i List files and inode number.
-R List directories , sub directories and their contents.
ls
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 153/798
Lists the files and
directories in the
present directory.
ls -l
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 154/798
l option lists the
long listing of
Files and
directory.
l l command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 155/798
File or directory
names.
Time stampSize of the filesor directories
The name of the group
which has the
permissions over thefiles or directories
Owner name, the
user who created
the directory.
No of links to the
directory
It defines the
permissions
assigned to the
owners, groups andother users
ls -a
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 156/798
[a] option lists all filesand directories including
hidden files
ls -al
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 157/798
al option lists all files
and directories includinghidden files in long listin
format.
ls -R
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 158/798
[R] option lists working
directory as well as
contents in the directory.
mkdir
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 159/798
mkdir :Make directory (or) To create a directory
Syntax :
mkdir <dirname>
mkdir
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 160/798
This will create adirectory advpro.
cd
cd
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 161/798
cd
- Change directoriesSyntax :
cd <directory name>
cd ..
- To a directory one level up (parent directory)
cd -
- To your previous working directory
cd /
- To the / (slash) directory
cd
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 162/798
This command
will take you to
the directory .
cd ~
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 163/798
Previous slide
we have seen cd
along with any
directory name.
This command
cd ~ <enter>will take to your
home directory
cd ..
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 164/798
cd .. Take you to theparent directory of
the current directory.
cd ..
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 165/798
Now we can see that
we are in advpro
directory, the parent
directory of the test
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 166/798
cd /
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 167/798
Confirmed
through the pwd
command
cd –Here the current
di i di
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 168/798
cd -
command will take
you to the previous
working directory
directory is newdir
when we enter cd -, ittakes to the previously
worked directory.Again cd - is given as
shown. Now it will take
to the previously
worked directory i.e.,(newdir)
catcat
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 169/798
– it is the command to create and view files
Syntax:
• cat [options] [filename]
cat > [filename] To create a file
cat [filename] To view a file
cat >> [filename] To append text to a
file
cat
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 170/798
As mentioned in
the previousslide. cat is used
to create a file
The file is savedthrough ctrl -d
after typing the
text
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 171/798
cat
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 172/798
To append the
text in a file,
Cat >> (symbol)
and file name.
cat
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 173/798
The screen
shows the
appended file
cat
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 174/798
The -s option
trims multiple
adjacent blank
lines into single
blank line
cat
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 175/798
The –b option
numbers the
each text line
of the output
cat
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 176/798
The –A option shows
all characters including
control and non
printing characters
Here the $ represents
the end of the line
touch
touch command is used to update the time stamps of a file.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 177/798
touch is also used to create empty file.
– Syntax : touch [filename]
touch can create multiple empty file too.
– Syntax : touch [filename1] [filename2]
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 178/798
M lti l fil
touch
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 179/798
Multiple files
are createdusing touch
command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 180/798
Copy Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 181/798
There is a file
named ‘a’ inthe directory
test .
Here we notice that
Copy Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 182/798
Here we notice that
test1 is a emptydirectory. Let us
copy the file ‘a’ intothis directory.
C i h fil ‘ ’
Copy Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 183/798
Cp copies the file ‘a’
from the directorytest to the directory
test1.
Copy Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 184/798
Thus the file ‘a’is copied to thetest1 directory.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 185/798
Copy Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 186/798
-r option copy
the entiredirectory tree‘old’
Copy Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 187/798
Thus thecontents of
old directoryis copied to
newdirectory.
Copy Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 188/798
Command l lshows the
permission of the file
Copy Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 189/798
Using chmod,permission of
the file is
changed
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 190/798
Copy Command
See the
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 191/798
comparisonof the file one shown above
in the new and old
directory
Copy Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 192/798
Now using commandcp along with –p option
the permission ispreserved.
mv : This command is used to move and renaming files
Move Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 193/798
mv : This command is used to move and renaming files
and directories
Syntax:
mv <source> <destination>
Example
mv file1 file2 (now the file1 is changed to file2)
Move Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 194/798
A file isavailable inthe name of
one in thedirectory old
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 195/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 196/798
Move Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 197/798
The file one isshown above in thenew directory
Move Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 198/798
Here a file iscreated test
in the old directory
Move Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 199/798
This exampleshows how to
rename a filetest to tested
Move Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 200/798
Using the l lcommand, theabove screen
shows therenamed file
rm and rmdir commandrm : This command is used to remove files
Syntax:
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 201/798
y
rm <filename>Example :
rm file1
rmdir : This command is used to remove directories.
Syntax:
rmdir <directory name>
Example :rmdir linux
rm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 202/798
This screenshows the
contents of thenew directoryThe above rmcommand is
used to remove
the file k
rm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 203/798
Here the file named
k is removed fromthe directory
rmdir command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 204/798
Here a directory iscreated named donic
which is removed throughthe command rmdir
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 205/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 206/798
rm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 207/798
Using rm withoption – r, the
directory alongwith contents canbe removed
rm -r command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 208/798
Now theabove screen
shows that
the directoryis removed
rm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 209/798
The above
screen showsthe contents of directory jerry
rm -ri command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 210/798
The rm with –ricommand is
used to remove
the contentsinteractively.
rm -ri command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 211/798
We can see that thefile for which we havegiven ‘y’ is removedand ‘n’ is preserved
The file command is used to check the file content.
File command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 212/798
Syntax :
file <filename>
Example:
file f1 (f1 is a file. File will show the format)
file /dev/fd0 (The output shows that the fd0 is a
block special file)
File formatThe file along with
file name (ss) shows
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 213/798
the file format
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 214/798
more
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 215/798
l l commandshows the
contents atonce.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 216/798
more
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 217/798
More is usedto lists the
contents onescreen at atime
more
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 218/798
More is beenprompted
after listingone by one
more
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 219/798
Here it isthe sameprocess
listing morecontents,shown as
above
more
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 220/798
Here it isthe sameprocess
listing morecontents,shown as
above
more
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 221/798
Now themorecommand is
over andwe are inthe end of the page
vi & vim editor
Vi is known as the visual editor.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 222/798
It is a standard editor under Linux and Unix system.
Vim is the improved version of vi editor
Vi have three modes of operation•Command mode
•Insert mode
•Esc mode
vi Modes
Command mode:
Operations such as cut copy paste delete
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 223/798
Operations such as cut, copy, paste, delete,
undo, redo etc., are done in this mode.
Insert mode:
Type in new text
Ex-mode :
Extended commands for saving, exiting, search-and-replace can executed here
Working with vi editor
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 224/798
exam is afile created
or openedwith the vieditor.
Command Mode
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 225/798
Press ‘i’ toget into
the insertmode
Insert Mode
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 226/798
This is theinsert mode
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 227/798
Ex- Mode
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 228/798
Press:wq to
write andquit
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 229/798
Yank
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 230/798
Hit escape andtype 3yy to yankthree lines from
the cursor position
Like this example,
you can copy anynumber of lines bytyping numbers of
lines and yy
Text yanked
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 231/798
In the previousslide, we saw how
to yank the text.After yanking wesee the message
as below
Text put
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 232/798
Now the yanked
text is pasted fromthe cursor position
by hitting the ‘p‘
delete
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 233/798
To delete text, place
the cursor in thebeginning of the lineand give the totalnumber and dd
delete
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 234/798
Now 3 lines aredeleted andmessage get
displayed as 3fewer lines asshown below
cut and put
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 235/798
To cut a lineafter curser
position hit 1cc.
cut and put
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 236/798
Get into insert modeand place the cursor
where the data shouldbe pasted. Press escto get in to command
mode
cut and put
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 237/798
Now hit p topaste the data.
Search
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 238/798
Get into ex modetype / followed by
data to besearched andpress enter
Search
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 239/798
When we press enter
it shows the firstfound match from
bottom to top.
Search
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 240/798
Then if we press ‘n’ it willshows the second match
for that data.If we continuepressing n it will showsuccessive matches.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 241/798
Find command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 242/798
This command
searches thepassword file from
/ directory.
Find command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 243/798
The above
screen showsthe execution of
command
Locate command
Locate:
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 244/798
To search or locate files and directories from the
database.
It locate the files faster than the find command
Syntax:
locate [pattern]
Locate command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 245/798
To search file
named test1from database.
Locate command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 246/798
All the files anddirectories named
test1 is locatedand displayed.
man :
f f
Man command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 247/798
Display helpful information about
commands.
Syntax:
man [option] command
Option:
–k - search by command description rather than
command name.
Man command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 248/798
It displays manualpages for lscommand.
Man commandThe manual pageof ls command is
di l d h
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 249/798
displayed here.
Enter q to exitfrom manual page.
useradd :
To create a new user account and login
di t f th t t
useradd command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 250/798
directory for that new account.Useradd will create new entries in system files.
Syntax
useradd [options] [user ]
Options-c Comment field.
-d Home directory
-e Account expiration date.
useradd command
User namedabdulkalam is
t d
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 251/798
created.
To set passwordfor abdulkalam.
useradd commandEnter thepassword.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 252/798
User home directory
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 253/798
When new user account is
created ,a logindirectory for theuser is created in
/home dir.
User configuration files
When a new user account is created, its entries
updates the following system files.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 254/798
- /etc/passwd
- /etc/group
- /etc/shadow
Passwd fileTo view
password
fi ti fil
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 255/798
configuration file.
Passwd file
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 256/798
First fieldrepresentusername.
x representsencryptedpassword isavailable inshadow file.
User id.Group id. User homedirectory.
User loginshell.
Shadow file
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 257/798
To viewshadow file.
Shadow file
Encrypted
password for
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 258/798
password for the user
abdulkalam.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 259/798
Group id for
the user
Groups file
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 260/798
the user abdulkalam.
User loginAbdulkalamlogging in .
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 261/798
User loginUser
home dir or login dir
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 262/798
User account canbe deleted through
userdel command
userdel command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 263/798
userdel command
Creating groupsNew group is created by hand-editing the file /etc/group or by using
groupadd command.
Syntax:
groupadd groupname
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 264/798
groupadd groupname
groupdel command is used to remove the group.
Syntax
groupdel groupname
Groupmod is used to rename the existing groupname.
Syntax:
groupmod –n newname oldname
Groupadd commandA group is added inthe name of india byusing the command
groupadd
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 265/798
groupadd.
Usermod command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 266/798
Using usermodcommand the user
abdulkalam isadded to group
India
Groups file
To view
group file
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 267/798
group file
Groups file
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 268/798
The last field shows
the user abdulkalamadded in India group
The id number
assigned to the groupindia is 501
Groupdel command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 269/798
Groupdelcommand deletes
window group.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 270/798
Create a directorynamed product
and group namedsales.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 271/798
User’s are added inthe sales groupusing usermod
command.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 272/798
Open thegroup file.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 273/798
This shows that thethree users are
added in the salesgroup.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 274/798
Change the group name
sales to product directoryusing chgrp command.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 275/798
The screen showsthat the changesbeen made in the
group field.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 276/798
Three files createdunder product directory.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 277/798
The permissionfor the product
directory ischanged.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 278/798
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 279/798
suresh logs in terminal. Ashe is the member of the
group, he have theprivilege to access the file.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 280/798
rajesh logs in terminal. Ashe is the member of the
group, he have theprivilege to access the file.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 281/798
tom logs in terminal. he isnot the member of the
group so does not have theprivilege to access the file.
Group Administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 282/798
The above screenshows the permissionbeen restricted to the
user tom.
Changing owner
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 283/798
The chown
commandchange the file or directory owner.
After giving thechown command
the owner ischanged fromroot to suresh.
Changing owner
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 284/798
The owner and
group name canbe change usingchown command.
chage commandThe chage command let you specify an expiration limit for a
user's account and password .
– Syntax:
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 285/798
ychage [option] username
Option
-l lists the current password expiration.-m set the min. days to change the password.
-M set the max. days to change the password.
-E specific expiration date for user account.
-I set inactive period (in days)
-W warning period, number of days beforeexpiration.
User administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 286/798
Chage –l : liststhe account and
passwordinformation of
user tom.
This field sets
the password for the maximum
valid days given.
Inactive period is
used to givegrace time tochange thepassword.
User administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 287/798
The –M
command with100 sets as themaximum days.
The password
expires field isupdated by +100days from user creation date.
User administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 288/798
Allowableaccount inactivity
period after which password
will expire.
User administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 289/798
The -W optionshows the
warningmessage before
expiration.
User administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 290/798
The -m option for minimum
number of days auser can existswith password.
The -E option isfor specific
User administration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 291/798
pexpiration datefor an account.
Set userIDIt allows an executable file to run under the user or group
security context with the permission of its owner.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 292/798
SUID can be set as follows:
• chmod u+s [filename]
(or)
• chmod 4xxx [filename]
Set userID
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 293/798
The above screen
shows file shadow andpassword along with
the set user idpermission.
The passwd is thecommand which updates
the password in theshadow file, instead of not having the execute
permission.
Set userID
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 294/798
Tom changes the
password usingpasswd command.
Set userID
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 295/798
The set userid
permission isremoved from the/usr/bin/passwd
file.
Set userID
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 296/798
Now we can view
that tom user cannot changethe password.
Set GroupID
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 297/798
The user suresh
logs get into theproduct directoryand create a file.
The user sureshwho create a file,the group name is
assigned as suresh.
Set GroupID
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 298/798
The groupid is
set to theproduct
directory.
Note: the group sales
is added to theproduct directory.
Set GroupID
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 299/798
After setting the group
id, user suresh createsa file win98. Using thecommand ls –l showsthat the file is createdunder the group sales.
Sticky bit
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 300/798
The user rajesh logsand he removes thefile bios created by
suresh.
The files remove ispossible because
the sticky bit is notset to the productdirectory.
Sticky bit
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 301/798
Using +t option the
sticky is set to theproduct directory.
Sticky bit
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 302/798
After assigning the sticky
bit, user rajesh try todelete the file created by
other user but he isunable to do it.
Switch user
su command is used to switch to another account from
the command line.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 303/798
This command is most often used by system
administrator to temporarily become the root user
without logging out of their non-privileged account.
Syntax
su - [user] -c command
Switch user
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 304/798
Here the root user
switching to another account.(user joe)
Switch user
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 305/798
It executes rootprivileged command
from the ordinary user account.
Multi user loginLike unix operating system where multi user login can
be done, in same sense the Linux operating system
supports multi user login.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 306/798
Each user can login in each terminal and can do multi
processing which avoids logging off from the system.
Multi user
t i th
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 307/798
tom, is the user who log in thefirst terminal
Joe, is theuser who log
Multi user
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 308/798
gin the second
terminal
Multi user
harry, is theuser who log
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 309/798
gin the third
terminal
Multi user
wilson, is theuser who log
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 310/798
gin the fourth
terminal
Multi user
bill, is the user who log in the
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 311/798
who log in thefifth terminal
Multi user thano, is the
user who logs
in the sixthterminal
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 312/798
terminal
W is the commandto list the users
logged in
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 313/798
Advanced Uses of VI and VIM
File RepositioningPress G, Cursor go to last line of a file.
Press 1G, Cursor go to first line of a file.
Press Ctrl+f, Cursor forward one full screen.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 314/798
Press Ctrl+b, Cursor go back one full screen.
Press Ctrl+d, Cursor go down half a screen.
Press Ctrl+u, Cursor go up half a screen.
Screen Repositioning
Press H, Cursor go to first line on screen.
Press M, Cursor go to middle line on screen.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 315/798
g
Press L, Cursor go to last line on screen.
Press Z+Enter, Make current line is first line on screen.
Press - (hyphen) Make current line last line on
screen.
It is also possible to read a other file content in your current files.
The following command help you :
– Go to exmode in a vi editor
Advanced Reading and Saving
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 316/798
– Syntax : r <filename>
– Example :r /root/file1
While working in a editor we can copy the file content toanother file
– Syntax : starting line, endingline w <file name>
– Example : 1,20w file2 – Example : 21,40w >> file2
FilteringA powerful feature of vi is the ability to include into your document
the output of Linux commands.
For example if you want to display any command output in your filesee following syntax
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 317/798
see following syntax .
!!command
The syntax will be working in exmod in editor.
For example to display date ,type following command in exmod.
!!date
Filtering
Open the filein vi mode.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 318/798
v ode.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 319/798
The output of the
date command iswritten here.
Filtering
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 320/798
Sed CommandSed command just like find and replace .
To display a file the Sed command change the
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 321/798
To display a file , the Sed command change the
particular word in standard input only , but not
change original content of file.
Example of Sed command .
sed ‘s/ram/raju/g’ /root/file1
Sed Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 322/798
The output of the
named.local is
displayed.
Sed Command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 323/798
Here sed command displays the
output by replacing the localhost
as www.example.com, but it
wont write output in the file.
ex mode : search and replacevi can perform search and replace operations much
like sed command.Syntax:
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 324/798
Syntax:
ex mode:1,$s/searchname/replacename/g
1,$ - address starting from line one.
s - String of character
g - replace multiple matches in a
line
ex mode : search and replace
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 325/798
Open the file
in vi mode.
ex mode : search and replace
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 326/798
It searches and
replaces the localhost
as www.example.com.
ex mode : search and replace
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 327/798
Thus the localhost
was replaced aswww.example.com
..
It is also possible to read a other file content in your current files.
The following command help you :
– Go to ex mode in a vi editor – Syntax : r <filename>
E l / /fil 1
Advanced Reading and Saving
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 328/798
– Example :r /root/file1
While working in a editor we can copy the file content to another file
– Syntax : starting line, ending line w <file name>
– Example : 1,20w file2
– Example : 21,40w >> file2
Advanced Reading and Saving
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 329/798
Here you can view
output of test file.
Open a file in vimode.
Advanced Reading and Saving
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 330/798
To display the
output of another
file named test inthe current file.
Advanced Reading and Saving
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 331/798
The output of test
file is displayed..
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 332/798
Advanced Reading and Saving
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 333/798
To write the contents of
the existing file in
another file named test1.
Advanced Reading and Saving
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 334/798
The contents are
appended to the
test1 file.
Advanced Reading and Saving
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 335/798
You can see the
appended contentsin the test1 file.
Configuring VI and VIMNumber of configuration are available in vi editor, see some of
example .
:set number - shows a line number on the left margin in a vi
editor
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 336/798
:set showmatch - when a right curly braces or a right paranthesis
is typed, a cursor will jump to the matching left curly braces or left paranthesis.
:set all - it shows all configurations.
Set number
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 337/798
File contents.
Set number
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 338/798
To assign numbers
to all line in vieditor.
Set all
To view all the
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 339/798
possibilities of
configurations
available in vieditor.
All the available
Set all
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 340/798
option are
displayed here.
Redirecting Input and OutputOuput of a command is redirected to a file
– Command > filename
Example ls -l > /root/file1
Example ls -i >> /root/file1
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 341/798
Output of file redirected to a command
– Command < filename
Example - cat < file1
• Error message of a command redirected to a file
- Command 2> file1
- Command 2>> file1
- Example – ll –L > file1
The output of ls
command isredirected to the
H h fil i
Redirecting Input and Output
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 342/798
file named ex.Here the file is
overwritten by the
output of lscommand.
The output of lscommand is
di t d t th
Redirecting Input and Output
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 343/798
redirected to the
file named ex1.
Redirecting Input and Output
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 344/798
Here the output of
ls command is
appended to theex1 file.
Redirecting InputA command which accepts the input from a file is
known as Redirecting Input.
Syntax - command < file1
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 345/798
Example : tr ‘A-Z’ ‘a-z’ < file1
A file is created in the name file1 and text is entered
in capital letters, which is redirected through < symbol
and the command translates the data to small letters.
l h
Redirecting Input and Output
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 346/798
tr translates the upper case
letters to lower case.Here
output of file v isredirected as input to the
tr command.
2> redirects the
error messages tothe ex file.
Redirecting Input and Output
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 347/798
Here we can see
redirected error
messages in the ex
file.
Piping
Pipes is used to execute more than one command at a time. See
following command.
Syntax : command1 | command2
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 348/798
Example: ls -l | more
It is also used to execute command result
Example: cat file1 | grep station
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 349/798
Redirecting Both Standard Output And Error
If find command is executed, its output can be stored in file2. if
error occurs during execution, the error message is stored in
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 350/798
file1.
For example:
find / -name passwd 2> file1 >file2
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 351/798
tee Commandtee is useful to save the output at various stages from
a long sequence of pipes.
Example: ls | tee a1 | ls –l | tee b2
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 352/798
Example: ls | tee a1 | ls l | tee b2
The above example shows the types of ls commandsand options are used to store output to the files g1,g2 and g3.
tee Command
It saves the output
of ls in file a1 and
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 353/798
output of ls –l in
file b2.
grep commandgrep
- means general regular expression processor.
-it analyze the content of a file a line at a time,
returning a line that matches a pattern.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 354/798
grep command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 355/798
Grep prints the
pattern matched
with ganesh in the
file /etc/passwd.
awk command
An awk program searches for lines in a file
and performs some action on those lines.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 356/798
Example:
awk ‘/bash/ { print }’ /etc/passwd
awk command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 357/798
awk display first
field of the
/etc/fstab file.
File CompressionsSeveral compression utilities are available for use on
Linux and Unix system.
But most software for Linux system use threecompression utilities.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 358/798
compression utilities.
1 - compress2 - GNU gzip
3 - bzip2.
Compression commandcompress:
It compresses a file and give the extension as .z for that file.
Syntax:compress <filename>
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 359/798
uncompress:
It uncompress the compressed file.
Syntax:
uncompress <filename>
Compression command
This
compresses
The actual
size of file is107 bytes.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 360/798
the file a.
Thus the file
size is
compressed to39 bytes.
The compressed
file is indicated bythe .z extension.
This
uncompress
the file a.
Compression with gzipgzip utility compresses file .
gunzip decompresses them.
To compress a file, enter the command gzip and the
filename.this replace the file with compressed
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 361/798
version of it,with the extension .gz.
To decompresses a gzip file use command gunzip.
Syntax:
gzip filename (compression)
gunzip filename.gz (decompression)
Compression with gzip
The actual
size of file is107 bytes.
gzip command
compresses the
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 362/798
file a.
The compressed
file is indicated bythe .gz extension.
Thus the file
size is
compressed to38 bytes.
This
uncompress
the file a.
It compresses files using the burrows-wheeler block-sorting text compression algorithm and huffmancoding.
You compresses files using the bzip2 command anddecompresses with bunzip2.
Compression with bzip2
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 363/798
The bzip2 command create a file with the extension.bz2
Syntax:
bzip2 filename (compression)
bunzip2 filename.bz2 (decompression)
Compression with bzip2
The actual
size of file is107 bytes.
bzip2 command
compresses the
fil
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 364/798
This
uncompress
the file a .
file a.
The compressed
file is indicated bythe .bz2 extension.
Thus the file
size is
compressed to51 bytes.
Creating ArchivesTar:
tar command is used to create archives on device or files.
Originally, tar was used to create archives on tape devices, hence
its name stands for tape archive.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 365/798
When creating a file for a tar archive, the filename is usually given
the extension .tar.
While tar is seldom used to back up entire file system.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 366/798
tar command
It create
backup for thefiles a,b,c,d,e
and f in
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 367/798
backup.tar.
The backup
files are
indicated by
.tar extension.
tar command
tf options
display all thefile in backup .
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 368/798
tvf options
displays along
with the user
and group
names.
tar command
If incase wemiss the file
then we can
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 369/798
extract those
file back using
xvf options .
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 370/798
g
Printer-configurationCommand to
configure the
Printer
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 371/798
Click New
option toadd printer
Now the system isloading printer
information
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 372/798
information.
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 373/798
Click Forward
option to add
printer queue
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 374/798
Chooselocally-connected
option for localprinter
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 375/798
Choose
forward option to
proceed to next step.
Choose any one the
manufacture name
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 376/798
manufacture name
in he list.
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 377/798
Choose the serial
number of the
printer
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 378/798
Choose apply
option for
What you haveselected
Now the printer configuration
are been
l i th
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 379/798
applying the
changes to the
system
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 380/798
Choose yes you will be
getting an test page form
the printer
lpq is a command to
view the queue in printer
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 381/798
lpr is a command given
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 382/798
lpr is a command given
to print particular file.
lpq is a command to
view the queue in printer
Printer-configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 383/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 384/798
Introduction to process
Linux treats each task performed on your system as aprocess, which is assigned a number and name.
You can examine this process and even stop them.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 385/798
Red Hat provides several tools for examining processes
as well as your system performances.
The process is easy monitoring is provided by severalGUI tools,like Red Hat Procman System Monitor.
ps Command• ps command is used to list the process.
• To display a information about process specific to
the active terminal.
• Syntax: ps [option]
• Options available:
-a : To display all process, not including
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 386/798
process not controlled by a terminal
-x : To include all process not controlled bya terminal, such as daemon process.
-l : To long list including more information such
as process owner's user id.
-u : To display user name of the processowner.
-e : To view the all process id
pstree command
It shows the
process ancestryfor all process
running on the
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 387/798
system.
ps –a command
Display all
processesexcluding
processes not
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 388/798
controlled by
this terminal..
It li t th
ps –l command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 389/798
It list the
processes along
with the owners
id.
Display all
processesincluding
processes
ps –x command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 390/798
controlled by
this terminal.
ps –u command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 391/798
It list the
processes alongwith the user
name.
kill process
• Kill command is used to send a particular process to
get clear.
• Syntax : Kill -9 <process id>
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 392/798
• ps - aux is the command to view all process name
and id
• Example: kill -9 3743 (This example shows the kill
command, option and the process id to kill.)
It kills the tty2
terminal bash
processes
kill process
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 393/798
processes .
Altering process schedule
• renice is the command to set the priority of a process.
• The priority value can range from -20 (highest priority)
to 19 (Lowest priority)
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 394/798
• Syntax : renice - +(minus symbol or plus symbol)
<priority number> -p <process id>
• Example : renice -15 -p 1970
Foreground and Background process
• Fg command is used to run the background process in
the foreground (Front End)
• jobs command helps you to view the background
processes.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 395/798
• Step 1: jobs <enter> to view the process
running and job numbers
• Step 2: fg %2 (job number)
• bg command is used to resume the suspendedcommand in the back grounded.
‘&’ makes the
command to run
in background.Jobs displays the
Foreground and Background process
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 396/798
in background.Jobs displays the
processes running
in the background.
Fg bring back the
back grounded
Foreground and Background process
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 397/798
back grounded
processes to the
foreground.
Here the
command is
suspended
whileexecution by
pressing ctrl+z.Bg resumes the
Foreground and Background process
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 398/798
Bg resumes the
stopped jobs to
the background.
Bash Shell Scripting
Scripting basics
– A shell script is a text file containing set of commands.
– Scripts are useful for automating process that you perform
repeatedly at the command line.
– Instead of typing commands, the commands are executed
through scripts.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 399/798
g p
– For example : Every morning when you login you can
perform following operations.
• Checking system date and time
• Checking email
• How many users have logged in the server.
Creation of shell scripts
Shell script are written in vi editor
The very first line, mention what type of script is used
– For example:
• #!/bin/bash used for bash shell script
• #!/bin/sh used for borne shell script
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 400/798
• #!/bin/csh used for C shell script
• #!/usr/bin/perl used for Perl shell script
• #!/usr/bin/python used for Python shell script
Basic bash shell script
How to print a data in a console
– echo “Red hat” <enter>
How to execute a command in echo statement
– echo “hostname `hostname` “ <enter>
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 401/798
– echo hostname hostname <enter>
How to execute a variable in echo statement – A = 10
– echo “A value: $A” <enter>
Execute bash shell script file
Two methods available to execute a script file are
– First method is
• Syntax :
» bash filename
– Second method is
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 402/798
Second method is
• Syntax :
»Give the execute permission the script file
through chmod command
»Run the file by ./<file name>
Get in tothe vi editor
to createscript file
Bash Shell Scripting
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 403/798
It denotes weare usingbash shell
scripts
Thi i t
Bash Shell Scripting
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 404/798
This scriptexecutes the
system hostnameand date
Executing script - First Method
Bashexample
(file name)to executethe script
Output is
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 405/798
Output isshown in the
terminal
No executepermissionfor a file in
default
Executing script - Second Method
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 406/798
Permission
is set to thefile, asexecutable
Second Method
./ example(file name)to execute
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 407/798
the file
Arithmetic Calculation
Examplescript file for calculation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 408/798
calculation
Arithmetic Calculation
Using readstatement weread the value
for A and BUsing expr we can
add values
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 409/798
The values are
entered for inputThe output isdisplayed
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 410/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 411/798
Partitions
The Linux supports four primary partitions and many
logical partitions in the extended partition.
The Linux kernel supports maximum number of 63
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 412/798
partitions on each IDE disk.
And maximum of 15 partitions on each SCSI device.
Partition Types
Linux-specific partitions would normally be one of the
following types with a unique ID.
0 X 5 - Extended
0 X 82- Linux swap
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 413/798
0 X 83- Linux0 X fd - Linux RAID
0 X 8e- Linux LVM
Partitioning
In Linux, partitions can be created by either of the
following three utilities
– fdisk
– sfdisk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 414/798
sfdisk
– disk druid (only available during installation)
– GNU parted
fdisk
fdisk
- Fixed Disk
- Menu driven programs to create anddelete partitions
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 415/798
Before starting fdisk, identify the hard disk type that is
whether primary master or slave and secondary
master or slave by using command fdisk -l.
l option list the
available
partitions
Total hard disk
space with total
heads, sectors and
cylindersAvailable partitions,
hdb t th t th
Star indicates
Starting and ending
cylinder for each
Size of the
i i i bl k
Partitioning with fdisk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 416/798
hdb represents that the
hard disk is connectedas primary slave
the boot
partition.
cylinder for each
partition onecylinder = 8.3MB
partitions in blocks
To create partition
in the device hdb
Partitioning with fdisk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 417/798
Type h or help to
shows list of
available commands
Partitioning with fdisk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 418/798
in fdisk
Type p to display
the available
Partitioning with fdisk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 419/798
the available
partitions
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 420/798
Enter the ending
cylinder or type thesize in MB.
Type w to save and
Partitioning with fdisk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 421/798
Type w to save and
exit from fdisk.
Instead of restarting to
update the partitiontable just enter the
command partprobe.
Partitioning with fdisk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 422/798
Thus a new
Partitioning with fdisk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 423/798
Thus a new
partition namedhdb6 is created
Red Hat Linux Filesystems
Red Hat supports following filesystems.
- ext2
- ext3
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 424/798
- minux
- reiserFS (under research)
ext filesystemsext : Extended filesystem.
ext2 : Older standard Linux file system supporting for filenames and
large file sizes.
ext3 : Standard Red Hat Linux file system, used for all hard disk
volumes under Red Hat Linux by default.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 425/798
It is the extension of ext2 with the feature of journaling (aware of
unexpected power outages and disk errors)
minux & reiserFS
Minux : This file system is small , simple and mostlyused for floppy disk .It support filenames up to 30characters.
ReiserFS : It is advanced journaling filesystem stillunder development for Linux.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 426/798
Its main difference between ext3 and reiserFS .Its usedisk resource efficiently and is particularly effectivewith file system containing many small files and largedirectories
Creating file system
Once you create a partition, you have to create a file
system on it.
To do this, use the mkfs command. To build the Linux
file system and pass the name of the harddisk
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 427/798
partition as a parameter.
Syntax:
mkfs -t <filesystem type> <partitioname>
Creation of file system
Current partitions
are displayed here
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 428/798
are displayed here
Creation of file system
Hdb6 7and 8 are
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 429/798
Hdb6,7and 8 are
newly created partitions.
Creation of file system
It creates ext2file system for
the device hdb6.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 430/798
To view the file system type
Dumpe2fs : this command is used to view which file
system we are using.
Syntax :
dumpe2fs <partitions>
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 431/798
p p
Example:
dumpe2fs /dev/hda1
To view the file system type
It displays the
file system
information's.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 432/798
Sparse_super
represents the
ext2 file system.
Mke2fs command
Mke2fs : This command is used to create file system.
Syntax :
mke2fs [options] device
Example:
mke2fs /dev/hda1 (it will create ext2 filesystem for
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 433/798
mke2fs /dev/hda1 (it will create ext2 filesystem for
hda1 partition)
mke2fs –j /dev/hda1 (it will create ext3 filesystem
for hda1 partition)
Creation of file system
It creates ext2
file systems for
device hdb7.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 434/798
View the file system type
S
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 435/798
Sparse_super
represents theext2 file system.
Converting ext2 to ext3 file system
It converts the file
system of hdb7 from
ext2 to ext3
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 436/798
View the file system type
has_journal
represents the ext3
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 437/798
p
file system thus theext2 is converted to
ext3
Mount command
In Linux, like any
other device the
partitions should be
Mount the partitions
hda6 in data1
directory and hda7 in
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 438/798
partitions should be
mounted.
directory and hda7 in
data2 directory.
Tune2fs command
tune2fs : It is a command used to converting from
ext2 to ext3 file system without un mounting..
Syntax :
tune2fs –j <partitions>
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 439/798
tune2fs j partitions
Example:
tune2fs -j /dev/hda1
View the file system type.
Ext2 is the current
fil f h
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 440/798
file system for the
device hdb6.
Tune2fs command
Here it converts the
file system for hdb6
from ext2 to ext3
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 441/798
from ext2 to ext3.
View the file system type.
Now the file
i d
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 442/798
system is converted
to ext3 file system.
Repair Filesystem
e2fsck : This command checks the consistency of the
file system and repair it if it is damaged, you can use
file system checking tools. Example : e2fsck /dev/hda1
fsck : This command checks and repair a Linux file
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 443/798
system. Example : fsck /dev/hda1
The main difference is e2fsck it will work in ext2 and
ext3 filesystem and fsck will work only in ext3 filesystem.
Repair Filesystem
fsck and e2fsck are
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 444/798
the command usedto check and repair
the file system.
Disk usage
df and du are used to check the disk usage.
df : It reports the amount of space used and
available on a mount file system as reported.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 445/798
du : It displays directories entries and the number of
data block assigned to them.
df command
df command
displays the space
used and available
in the mounted file
systems
df -h, displays size
in human readable
format in the power
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 446/798
df -H displays the
size in the power
1000 instead of
1024.
format in the power
of 1024
du commanddu command displays
the estimate file space
usage available
df -h & H, displays size
in human readable format
in the power of 1024 and
1000 respectively
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 447/798
1000 respectively.
Performance tools
free command lists the free ram memory and as well as
what is used for buffers and swap memory.
top command lists the most CPU intensive processes.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 448/798
Vmstat shows the performance of system components.
free command
free command
display
information
about free and
used memory
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 449/798
used memory
on the system.
vmstatReport virtual
memory statistics
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 450/798
topDisplays top
CPU processes
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 451/798
top
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 452/798
It displays the
listing of most
CPU-intensive
tasks on the
Some process start at boot time and continue runninguntil the system is shutdown. Such process are
known as daemon processes.
Two types of daemon process:
Daemon Process
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 453/798
standalone daemon
Transient daemon
Standalone daemon are a program that run all the time
and are started up either directly by init or by a startup
script under /etc/rc.d.
Daemon Process
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 454/798
Transient daemon are only started up when they areneeded, and are controlled by a standalone daemon
called xinetd.
checkconfig command
The chkconfig command can also be used to activate anddeactivate services.
The chkconfig --list command displays a list of systemservices and whether they are started (on) or stopped (off)in runlevels 0-6.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 455/798
At the end of the list is a section for the services managedby xinetd.
chkconfig can also be used to configure a service to
be started (or not) in a specific run level. For
example, to turn httpd off in runlevels 3, 4, and 5,
use the following command:
checkconfig command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 456/798
use the following command:
chkconfig --level 345 httpd off
--list options
used to list the
checkconfig command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 457/798
service.
--list option
lists xinetd
checkconfig command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 458/798
services also.
--list option list
httpd service
status on
This command
httpd service is
--list options
used to list httpd
checkconfig command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 459/798
status on
runlevel 0-6.
p
stop on runlevel3-5.
service status .
--del option deletes
all links for the
--list options shows
sendmail service is
--add options used
to add a service,
Now --list
options used to
checkconfig command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 460/798
service in allrunlevel directories.
not there.creating links indefaults runlevels.
list the httpdservice.
Standard Boot loader
• There are two standard boot loader are used inLinux
• GRUB
• Grand unified boot loader
• LILO
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 461/798
• LILO
• Linux loader
GRUB
• GRUB Grand Unified Boot Loader
• is a multi boot loader that operates similar to LILO and
default boot loader for Redhat Linux.
• Using GRUB user can select operating systems to run from
a menu interface displayed when a system boot up
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 462/798
• Supports MD5 password protection, a boot menu editingmode and a shell like command line interface available at
boot time.
LILO
• LILO means Linux loader
• LILO is a program written to boot sector of a disk that loads
the OS and starts execution.
• It is an older version of boot loader of Red Hat Linux.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 463/798
• LILO loads the Kernel based on its actual sector location on
the disk , rather than its file name
• /etc/lilo.conf - Configuration file
• lilo -v - To install or update the lilo
boot loader.
• lilo -t - Test the configuration beforeinstallation.
LILO
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 464/798
• lilo -u - To restore the MBR backup.
• Grubby - bootloader-probe : to showthe a current boot loader.
Lilo installation
Check the
presence of
the lilo
package.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 465/798
Copy thelilo.conf.anaconda
to lilo.conf (lilo
configuration file).
lilo –vinstalls lilo
boot loader.
Thus the lilo
boot loader
is installed.
Lilo installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 466/798
This command displays
the current boot loader,
thus we can see the lilo
got installed.
Open the lilo
configuration file.
Lilo installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 467/798
Prompt presents to
boot promptwithout any user
intervention.
Denotes the
first stage
boot loader.
Locates the
second stage
boot loader.
To display a
text message
at boot time.
Boots the
kernel image.
Incase of dual
Specify which
OS will be
loaded by
default.
Lilo installation
Before booting
the OS it will
wait for five
seconds.
It specifies the file
that contain
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 468/798
Incase of dual
OS it boots the
other.
images to beloaded it to initial
RAM disk.
Prompts the user for
a password before
booting this image.
This will prompt for
password only when
we go to single user
Lilo installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 469/798
g g
mode.
This will update the
lilo configurationfile.
Lilo installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 470/798
• /boot/grub/grub.conf
• This is configuration file for grub boot loader.
• grub-install /dev/hda
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 471/798
• To install the grub boot loader in hda device.
• grubby –bootloader-probe
• To show the current boot loader .
Open the grubconfigurations
file.
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 472/798
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 473/798
The options rhgb quiet
will start xserver
while booting.
Remove this options
to boot through text
mode.
Grub Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 474/798
Save the file
and exit.
Now reboot the
system.
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 475/798
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 476/798
Now system is
booting in text mode .
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 477/798
Now system is
booting in text mode .
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 478/798
Now system is
booting in text mode .
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 479/798
Now system is
booting in text mode .
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 480/798
Now system is
booting in text mode .
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 481/798
Now system is
booting in text mode .
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 482/798
Now system is
booting in text mode .
Open the grubconfigurations
file.
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 483/798
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 484/798
The options rhgb quiet
will start xserver
while booting.
Now reboot the
system.
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 485/798
GRUB Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 486/798
Now system is
booting ingraphical mode.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 487/798
In EL-4 redhat-config-
* tools are renamed as
system-config-*.
GRUB installation
Now the
boot loader
is lilo.
To install grub loader
use the command
grub-install /dev/hda .
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 488/798
Open the
grub
configuration
file.
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 489/798
If default is
set to zero
then it boot
through first
stanza.
Label for
first stanza.
Label for
d
Flash screen to
be displayed at
boot time.
This represents that the
following files are in 5th
partition of the hard disk
on hd0.
Boots the kernel
image.
It loads the initial
RAM disk.
Loads the
dual OS.
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 490/798
secondstanza.
To set password
to the grub boot
loader.
It gives us the encrypted format of the
password. This password is supposed to
b t d i th b f fil Thi
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 491/798
be entered in the grub.conf file. Thiscan be done by the following method.
Following the above
command type the password
two times, this will append
the encrypted password to the
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 492/798
grub.conf file.
Open the
configuration
file.
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 493/798
Here we cansee the
appended
password.
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 494/798
Just cut andcopy the
password
here.
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 495/798
Save the file and
restart the
system.
Here you can see thegrub loader prompting
for the OS to boot.
Type p to enter
grub password if
you want to go to
single user mode.
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 496/798
Enter the
password
here.
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 497/798
Change the command
prompt to get in tosingle user mode to do
that press ‘e.’
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 498/798
Enter 1 to get in
to run level 1
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 499/798
to run level 1.
Press b to boot.
GRUB installation
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 500/798
Red Hat Packet Manager (rpm)
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 501/798
• rpm command is used to manage and install software
packages.
• This command performs installation, removal and
verification of software package.
• Each package is actually an rpm packages.
• rpm consists of an archive of software file and
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 502/798
information to install.
• Each archive is resides as a single file with a name that
ends with .rpm
rpm command is used either for installing or uninstallingpackage.
Syntax:
rpm [parameter] package name [options]
parameter:(hyphen) -i - Installs package.
-U - Updates package.
-e - Remove a package.
-qi - Displays information for an installedpackage
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 503/798
package.-ql - Displays file list for installed package.
-qpi - Displays information from an rpm package file.(used for uninstalled packages)
-qpl - Displays file list from an rpm package file. (usedfor uninstalled packages)
Options:
--force - Forces installation despite conflicts.
--nodeps - Install or remove without doing any
dependency checks.
aid Automatic dependency to install a package
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 504/798
--aid - Automatic dependency to install a package.
(While available of package rpmdb-redhat
aid option will work)
Querying the packing
rpm –q acommand for
querying a
particular package
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 505/798
rpm –q checkswhether the above
package is installed.
rpm –e commandwill remove thehttp package.
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 506/798
For installing the package we must the
mount the operating
system cd-rom of
RHEL and then only
we can install the
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 507/798
we can install the
packages.
Go to
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 508/798
Go toRedhat
directory.
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 509/798
Go to
RPMS
directory.
List the files in
RPMS directory
and we can see
that the packages
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 510/798
that the packages
end with an
extension .rpm.
rpm –qpi showsthe informationabout the packagebefore installation.
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 511/798
rpm –qplshows the
list of files ina package
beforeinstallation.
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 512/798
rpm –ivh is
to install a
package.
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 513/798
rpm -Uvh, to
upgrade a package.
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 514/798
rpm –qi
shows theinformationabout the
package after
installation
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 515/798
installation.
rpm –ql showsthe list of files in
a package after installation.
Using rpm command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 516/798
To view an IP-addressTwo methods available in linux to view the ip address
ifconfig :
-shows the ip address of the active interfaces with hardwareaddress.
-it can show ip address of a particular interface by taking the interface
name as argumentexample:
ifconfig eth0
ip a :
- simply shows the ip address of all interface.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 517/798
Ifconfig command
Displays
information onall currently
active interfaces.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 518/798
Here it displays
the information
of eth0 interface.
Ifconfig command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 519/798
ip a command
Here it displays the
information about
all the interfaces.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 520/798
ifup / ifdown commandIfup:
-ifup command is used to activate the interfaces.
Syntax:
ifup <interfacename>
Ifdown:
-ifdown command is used to deactivate the interface
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 521/798
ifdown command is used to deactivate the interface
Syntax:
ifdown <interfacename>
It deactivate the
ifup / ifdown command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 522/798
It deactivate the
the interface
eth0.
Now you can
notice the interface
eth0 is deactivated.
ifup / ifdown command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 523/798
It activates the
interface eth0.
ifup / ifdown command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 524/798
Now you can
notice the interface
eth0 is activated.
ifup / ifdown command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 525/798
In linux ip address can be assigned by the following methods.netconfig:
- to assign permanent ip address to the interface
Ifconfig:
- to assign temporary ip address to the interface.Syntax:
ifconfig <interfacename> <ipaddress> subnetmask<subnetmaskaddress> broadcast <broadcastaddress>
Ip a a :
- to assign additional ip address temporarily
Assigning ip address
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 526/798
Syntax:
ip a a <ip/subnetmaskaddress> dev <interfacename>
Assigning ip address
To assign permanent
ip address using
netconfig command.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 527/798
Press yes to assign
Assigning ip address
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 528/798
Press yes to assign
ip address.
To assign ip
Assigning ip address
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 529/798
To assign ip
address
automatically
from dhcp server.
To assign ip
Assigning ip address
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 530/798
o ass g p
address manually.
Using ifconfig
command ip
address can be
assigned.ip a command
Assigning ip address
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 531/798
ip a command
shows the
assigned ip
address.
As said earlier,
ifconfig is used to
assign ip addressil
When network
service is restarted,the ipaddress
assigned through
ifconfig to the
device is removed.
Assigning ip address
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 532/798
temporarily.
To update ip
address thenetwork service
is restarted.
ip a command
Assigning ip address
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 533/798
p
shows the
assigned ip
address.
ip address can be assigned
temporary using
ip a a command.
Assigning ip address
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 534/798
Ip address can be
removed using
ip a d
command, once
network serviceis restarted it get
Assigning ip address
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 535/798
is restarted it get
removed.
Router configuration
The ip_forward file is
assigned 1 for enabling
the router or 0 for
disabling.( Thisprocess for
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 536/798
process for
temporary.)
To enable the router
in permanent way get
into the sysct1.conf.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 537/798
The 1 is assigned toenable the router and
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 538/798
enable the router and
this file is for setting
router in permanent
manner.
Gateway can be addedusing the command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 539/798
using the command
route add.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 540/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 541/798
ping command
It is used to detect whether a system is up andrunning.
Syntax:
ping [options] <domainname>or
ping [options] <ipaddress>
Options:
a - audible pingb - to ping the broadcast address
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 542/798
b to ping the broadcast address
c - stop sending packets after count.
It checks whether
www.example.com
is up and connectedto the network
ping command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 543/798
to the network.
ping command
It checks whether
192.168.0.253 machinei d t d t
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 544/798
is up and connected to
the network.
-b option used
to ping a broadcast
address.
ping command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 545/798
-c options stops
sending packets
after the
specified count.
ping command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 546/798
• LVM structure
• In this structure the LVM physical partitions are
also known as extents, are organized into logical
groups, which are in turn used by logical volumes.
LVM Structure
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 547/798
Physical volume
• Physical volume:
• It is nothing but hard disk partition that you create
with partition creation tools such as parted or fdisk.
• The partitions type can be any standard Linux
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 548/798
partitions type, such as ext2 or ext3.
Volume groups
• Physical volumes are organized into logical groups,known as Volume groups
• Volume groups that operate much like logical harddisk.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 549/798
• You assign collection of physical volume to differentlogical groups.
Logical Volumes
• A logical volume is a virtual partition.
• One or more physical volumes to be combined in tovolume group to construct logical volumes.
• Logical volume can be created in logical groups.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 550/798
• It functions much like hard disk partitions on a
standard setup.
lvm
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 551/798
Create partition
using fdisk command
Type p to check
how many
partitions available
in hard disk
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 552/798
Here 4 partition
is created with
equal sizes of
100mb through
n option.
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 553/798
Newly created
partition is
listed below as
hdb6,7,8 & 9.
To know the
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 554/798
To know the
partition id, use
the option l.
Here 8e represent
lvm partition id.
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 555/798
Here below after
giving ‘t’ option
the partition id is
changed to lvm
We have tomention the
hex code of
the partition
To change the
partition id as lvmid, use T option.
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 556/798
Now
partition id is
changed to8e(LVM)
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 557/798
We save the lvm
partition throughw option.
Previous versions of
redhat needed to
restart system after
ti titi I
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 558/798
creating partition. In
current version to
avoid restart we use
partprobe.
Physical volume iscreated for lvm
partition(hda6.7.8&9)
Pvdisplay commandshow the details of
physical volume
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 559/798
pvdisplay command
displays the physical
volume size.
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 560/798
Vgcreate creates
group as test0 for lvm partition hdb6
vgdisplay command
displays theinformation about
volume group test0.
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 561/798
lvcreate creates a
logical volume and we
assign name as data inthe test0 group
lvdisplay,
displays the
information
about logicalvolume.
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 562/798
Make2fs, creates
an ext3 file
system for data.(logical volume)
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 563/798
The logical volumedata is mounted
to /data directory.
Open fstab file for permanently mounted
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 564/798
the logical volume data.
See thecontent of
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 565/798
fstab file.
Logical volume name isdata is mounted on
/d di
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 566/798
/data directory
permanently .
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 567/798
Here we can see free
space of logical volume
data.
Create a big file of size
40mb in /data directory.
Here we can see there isno free space available
i /d di
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 568/798
in /data directory .
If the space
assigned to data is
Extend the logical volume
size upto 45mb using
lvextend command.
Now create filesystem for
the extended volume using
ext2online.
After extending volume nowwe see the free space
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 569/798
assigned to data is
not sufficient, we
can resize the
logical volume .
available in /data directory.
Here we can see only
12mb free space ia
available in the volume
group.
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 570/798
Now the screen
shows that test
volume group is
increased to 200mb.
Note that the total
allocated size for
the test0 group is
100 mb.
vgextend, extends
the space from
hdb7.
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 571/798
The above
command shows
the increased
space of logical
volume data.
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 572/798
Extend the logical volumesize upto 50mb using
lvextend command.
Now create filesystem for
the extended volume using
ext2online.
After extending volume nowwe see the free space
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 573/798
available in /data directory.
We can remove logical
volume first we mustunmount the logical volume
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 574/798
g
(/data directory).
Remove themounted entry of
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 575/798
logiacl volume
(data) in fstab file
After removinglogical volume
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 576/798
save and exit the
file.
Remove the logical
volume name is data
We can remove volumegroup first we must
After deactivated thegroup will be removed
LVM Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 577/798
volume name is data
using lvremove
command.
decativate the volume
group using vgchange
command.
using vgremove
command.
RAID
• RAID means Redundant Arrays of Independent
Disk .
• RAID is a method of storing data across several
disks to provide greater performance and
redundancy.
• In effect, you can have several hard disks treated
as just as one hard disk by your operating system.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 578/798
Types of RAID
• RAID can be implemented on a
• Hardware level
or
• Software level
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 579/798
Hardware RAID
• On a hardware level, you can have hard disk
connected to a RAID controller, usually a special
PC card.
• Your operating system can accesses storage
though the RAID hardware controller.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 580/798
Software RAID
• You can implement RAID as software controller,
letting a software RAID controller program.
• The controller program manage access to hard
disks treated as RAID device.
• The software version lets you use IDE hard disks as
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 581/798
The software version lets you use IDE hard disks as
RAID disk.
Software RAID LevelsRAID levels Capabilities Description
Linear Appending Simply treat RAID hard drives as one virtualdrive with no striping, mirroring.
0 Striping Implements disk stripping across drives withno redundancy.
1 Mirroring Implements a high level of redundancy. Eachdrive is treated as mirror for all data.
5 Distributed Parity Implements data reconstruction capability
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 582/798
5 Distributed Parity Implements data reconstruction capabilityusing parity information. Parity information isdistributed across all drives.
RAID
rpm -q command
checks, whether the
mdadm installed
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 583/798
RAID
The partition is
created usingfdisk command.
Now the screen lists
the partitions.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 584/798
p
The partition is
created usingfdisk command.
Now the screen lists
the partitions.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 585/798
4 Partitions is
created using n
option with equal
size of 100 mb
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 586/798
Now use ‘p’ to
check created
partitions.
The l option, lists the
file system. The fddenotes linux raid
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 587/798
The l option, lists the
file system. The fddenotes linux raid
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 588/798
To set the
partition type use
t options.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 589/798
Option p lists the
partition id and
show the changes.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 590/798
We save the raid
partition throughw option.
Previous versions of
redhat needed to
restart system after creating partition. In
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 591/798
current version to
avoid restart we use
partprobe.
Using mdadm tool
creating raid level 5 it usefour partition
/dev/hda6,7,8&9 and
creating raid device is
/dev/md0.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 592/798
Watch command
shows the onlinestatus of raid
devices.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 593/798
Here we seestatus of each raid
disk.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 594/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 595/798
Here we see the
ext3 file system iscreated.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 596/798
mdadm –detail
command show thedetail information
about the raid
devices.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 597/798
Here we see each
raid disk major &minor no. .
Its show the raid
disk status (weather raid disk active or
not active ).
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 598/798
Now raid device
(/dev/md0) ismounted on /data
directory.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 599/798
Now raid device
(/dev/md0) is mounted
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 600/798
on /data directory in
/etc/fstab file for
permanently.
Now go to /data
directory and
create the file
name is file1 using
dd command.
df command show
free & used space
f h id d i
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 601/798
for the raid devices
& partitions.
Mdadm –query
command show theinformation about
particular raid device
& partitions.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 602/798
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 603/798
Mdadm – manage
command set fault or fail particular
partitions (/dev/hda9).
Cat /proc/mdstat
command show disk
the disk is failed.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 604/798
Here see mdadm –
detail commandshow disk
/dev/hda9 is faulty.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 605/798
Now remove the
/dev/hda9 partitionfrom the raid
device /dev/md0
using Mdadm –
manage command .
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 606/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 607/798
Now add the
/dev/hda9 partitionfrom the raid
device /dev/md0
using Mdadm –
manage command .
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 608/798
Watch command
shows the onlinestatus of raid
devices.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 609/798
Here we can see thestatus of online
synchronization of raid
disks.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 610/798
Now the faulty
disk is replacedand we can
see the data.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 611/798
Here you can see
mdadm –detailcommand show
disk /dev/hda9 is
active.
Raid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 612/798
Disk quota
Disk quota is used to control how much disk space a particular
user can access.
Quota tools:
quotacheck
quotaon
quotaoff
edquota
repquota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 613/798
Quota tools
Quotacheck:
It scans the file system for the current disk usage and update the
aquota.user file.
Quotaon:
It turns on the quota.
Quotaoff
It turns off the quota.
Edquota:
It is used to set disk quotas for a user.
Repquota:It displays summary of disk quotas and and the quota usage .
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 614/798
Implementing quota
To implement disk quota for an user, set the user quota for the home
directory by replacing its “defaults” entry with “usrquota” in fstab file.
The following slides will guide you how to implement disk quota for
particular user.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 615/798
Open the
fstab file.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 616/798
Replace this
defaults as
usrquota.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 617/798
Now usrquota
is assigned to
the /homedirectory.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 618/798
Here you can see that
the user quota is not
updated for the /home
directory.
Remount the
/home directory
to update.
Now you can see
the user quota got
assigned to /homedirectory
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 619/798
Create quota
database file named
aquota.user to hold
the quota
information for all
users.
It checks the
validity of quota
database of the
/home directory.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 620/798
Turn on the
quota.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 621/798
Let us set
disk quota for
the user jack.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 622/798
To assign the
quota for the
user jack.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 623/798
Blocks
represents disk
space in KB.
The maximum memory
space for a user. This will
deny the user to access, if he exceeds the quota limit.
This soft limit will
just issue a warning if
he exceeds soft limit.
Inode represents
number of files anddirectories can be
accessed by the user.
To set soft
limit for the
inode .
To set hard
limit for inode.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 624/798
accessed by t e use .
Here we set soft
limit as 40 KB
memory space .
Here we setsoft limit as 15
inodes .
Here we set hardlimit as 50 KB
memory space .
Here we set hard limitas 20 inodes .so that
user can access only
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 625/798
max of 20 inodes.
It displayssummary of
disk usage.
User jack has a hard
limit(block limits) of 50KB
and soft limit of 40 KB, he
already used 10KB
User jack has a hard limit
(file limits) of 20 inodes and
soft limit of 15 inodes , he
already used 10 inodes
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 626/798
already used 10KB. already used 10 inodes.
User jack created five files without
any warnings. But when he create
sixth file a warning message is
displayed. This indicates the user
had exceeded the soft limit
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 627/798
had exceeded the soft limit.
Now, when the jack attempt
to create more than ten files
i.e., the eleventh file then
write failed message occurs.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 628/798
Here jack use ddcommand to create a
file named ‘1’ of 30KB.
Since the user exceeds
the soft limits a warning
messages is occurred.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 629/798
Here jack attempt tocreate a file named ‘2’ of
10KB . But since, he has
exceeded hard limit write
failed error occurred.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 630/798
Here we can notice that
the jack had used all thisquota. So he is restricted
to create files.
Implementing quota
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 631/798
mount command
Mount
Used to mount a file system
It takes two argument : the storage
device and the mounting point.
The device is a special device file that
connects the system to the hardware device.
Mounting point is directory on which the
storage device is to be mounted.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 632/798
Syntax:
mount [options] <device> <mountpoint>
Options:
-w mount the file system with read/write permission.
-r mount the file system with read permission.
-t to specify the type of file system to be mounted.
-a mounts all the file systems listed in /etc/fstab.
mount command
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 633/798
umount command
It un mounts the mounted file system.
The removable media like floppy disk, and cd are unmounted after use, by using umount command.
Syntax:
umount <mountpoint>
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 634/798
mounting CD-ROM
To mount the
CDROM on the
mounting
point
/mnt/cdrom
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 635/798
mounting CD-ROM
Now we can access
the CDROMcontents from the
mounting point.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 636/798
Unmounting cd-rom
Unmount the
CDROM
after access
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 637/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 638/798
Mount /unmount floppy
To mount the
floppy on the
mounting
point
/mnt/floppy.Unmount the
floppy after
access.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 639/798
Mounting Hard drive partitions
To mount a hard drive partition
The hard disk partition also can be mounted likeany other file systems.
Example :
mount –t ext3 /dev/hda4 /mnt/data
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 640/798
To mount the hard disk partition (hda3 of ext3
file system) in /data
directory.
Mount commandlists the mounted
device.
Mounting Hard drive partitions
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 641/798
Mounting NFS (network file sharing) :
– Before mounting we must know the filesystem are exported by a remote
system. The following command is used to know the directory shared.
showmount –e remote_server
– When the host and share name are known, the following command is used
to connected the network file system to the local file system tree
mount remoteserver:/shareddir /mnt/newdir1
Mounting NFS
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 642/798
Showmount commanddisplays the shared
directory on
192.168.0.253
machines. .
Mounting NFS
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 643/798
We mount the el
directory from remotemachine into our /mnt
directory .
Mounting NFS
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 644/798
Mount command
shows information'sabout mounted
devices.
Mounting NFS
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 645/798
umount command usedto unmount remote
machine directory.
Mounting NFS
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 646/798
This command helpsto view windows
shared files.
Mounting smbfs
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 647/798
The above screens
displays window
shared directory.
Mounting smbfs
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 648/798
umount command used
to unmount remote
machine directory.
Mounting smbfs
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 649/798
Auto mount/etc/fstab:
We can also mount the file system by placing mount
information in this file.
Using entries in this file the file system can be automaticallymounted whenever the system boots.
It consists of six field per line for each file system as follows
<device> <mountpoint> <fs_type> <options> <dump_freq>
<fsck_order>
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 650/798
Open the
fstab file.
Auto mount
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 651/798
It represents
the devices.
It represents
the mount
points.
It represents
file systems.
It represents
different options
for mounting thefile system.
It represents
the dump
frequency.
It represents
the fsck.
Auto mount
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 652/798
Autofs
Autofs service mounts the file system automatically
when the user access the mounting point.
The autofs to supports the removable media without
recurring the user to do any thing more than insert
the media
Autofs configurations file are
/etc/auto.master
/etc/auto.misc
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 653/798
Autofs configurations files
/etc/auto.master:
This file specifies that a mount root of /misc will be
used for a file systems and that mounts will time out
after 60 seconds of inactive.
/etc/auto.misc:
The device to be mounted and the corresponding
file system is configured in this file.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 654/798
y g
Open the
auto.master
file.
Autofs configurations files
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 655/798
Mounting
information's
should be
entered here.
Autofs configurations files
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 656/798
It represents
the mounting
point.
Map file having
information's about
the file systems to bemounted.
This specifies when
to unmounted the
auto mounted filesystem.
Autofs configurations files
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 657/798
Open the
auto.misc
file.
Autofs configurations files
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 658/798
Mounting device
information's are
t d h
Autofs configurations files
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 659/798
entered here.
Key, the name of
the subdirectory
where the data
It represents file
system type.
It represents
the device to
be mounted.
Autofs configurations files
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 660/798
can be accessed .
Now autofs service
is restarted.
Autofs configurations files
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 661/798
The contents of the
cdrom is now
available in the
mounting point/mnt/cdrom/cd .
Autofs configurations files
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 662/798
As soon as we come out
from /mnt/cdrom/cd the
file system will get
automatically unmounted
Autofs configurations files
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 663/798
automatically unmounted
after 10 secounds.
Scheduling Task: cron
Cron Schedules one-time maintenance tasks.
Cron is ideal for setting up jobs that execute regularly at
specified times or intervals.
It contains a file which contains commands for cron, settingup and configuring jobs.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 664/798
Creating cron
cron tab files are stored in /var/spool/cron.
This file is accessed only by the root user, whereas theother users cannot access.
User can access this file by using crontab command.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 665/798
syntax for crontab:
crontab [option]
Option :-e : edit the crontab file.
-l : lists the content of the crontab.
-r : remove the content in crontab.
Creating cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 666/798
Root user has
the privilege to
open this file.
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 667/798
Now open
the file.
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 668/798
First field
represents
minutes(0
-59).
Second
field
indicateshours(0-
23)
This files
indicates,
day of themonth (1-
31)
This field
indicates
the month(1-12)
This field
indicates
the day of the
week(0-6)
Command
can be
given inthis field
The above command
gets executed at 13
hours, 34 minutes as
daily basis at same time.
If anyvalues is
not
represented,
we canmention *
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 669/798
The service isrestarted using
service crond
restart.
Chkconfig command
enables the crond
services in runlevel
345 in next boot time.
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 670/798
Automatically
“hello” message
gets displayed in
terminal.
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 671/798
As said before the root user
only has the privilege to
access the file.
The permission isdenied to the normal
user joe when the
user attempts to the
file.
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 672/798
The user can access
the file,
using
crontab –ecommand.
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 673/798
Now open
the file.
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 674/798
The above command
gets executed at 13
hours, 40 minutes as
daily basis at same time.
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 675/798
Crontab –l command
used to display content
of crontab file.
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 676/798
Automatically
“hello joe “message
gets displayed interminal2.
Scheduling Task: cron
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 677/798
DNS• DNS - Domain naming system.
• DNS service locates and translates domain namesinto corresponding associated IP addresses.
• DNS configuration.
• It requires the following software packages to be
installed.• bind
• Caching-name server
• bind utils
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 678/798
• bind-utils
Service profile
Packages - bind, bind-utils,
caching-nameserver
Configuration files - /etc/named/named.conf
/var/named/named.local
Daemons - named
Port number - 53
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 679/798
Install bind, this
package includes
web page manuals
and documentation
Install bind-utils
which providesmany utilities like
host, dig and
nslookup
Install caching-
name server which
provides a working
named.conf
configuration file
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 680/798
configuration file
Open this file for
mentioning the home
directory for DNS.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 681/798
Here DNS home
directory is
/var/named/chroot.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 682/798
View the homedirectory files.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 683/798
Open the
configuration
file named.conf.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 684/798
Now you are
seeing the
contents of
named.conf file.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 685/798
Forward zone mapping
between fully qualified
domain to particular ip
address.
This filecontains the ip
address and
the locations
of all the dot
servers.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 686/798
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 687/798
Enter the
forward file
name.
Copy and paste the
forward and reverse
zones and edit them as
follows.
Enter the
domain
name here.
Enter the IP
address inreverse
order.
Enter the
reverse
file name.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 688/798
Save and exit
the file
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 689/798
Copying the syntax
file named.local to
example.for andexample.rev.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 690/798
Open the
forward file.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 691/798
Enter the fully
qualified name of
the name server.
It is interpreted as
the name of theoriginating
domain.
Enter the authorised
name server for this
zone.
Enter the fully
qualified name of
host.Enter the last number segment of the host
address in the reverse
zone file.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 692/798
Replace local hostto fully qualified
name using as given
below.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 693/798
Now the localhost is
replaced as
server1.example.com.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 694/798
Enter the ip address for
specified domain name.
Canonical name, is used
to define an alias for ahostname. Set www as
the cname for
server1.example.com.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 695/798
Open theexample.rev
file.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 696/798
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 697/798
Replace localhost toserver1.example.com
using as below.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 698/798
Now the localhost is
replaced by
server1.example.com.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 699/798
In a PTR record, you can
specify just that last
number segment of the
address.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 700/798
Open theresolve.conf
file.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 701/798
Mention the nameserver
ipaddress and domain
name here.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 702/798
Now named
service is
restarted.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 703/798
Thus the DNS makes it possibleto ping an host by its domain
name by resolving the domain
name into IP address.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 704/798
Thus the DNS makes it possibleto ping an host by its domain
name by resolving the domain
name into IP address.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 705/798
dig command shows ip
address of the specified
fully-qualified domain
name
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 706/798
name .
Nslookup is a dns
diagnostic tool used toquery a dns server.
Using nslookup you can
identifies nameserver for
particular doamin.
Using nslookup you can
identifies address for
particular FQDN.
Using nslookup you can
identifies FQDN for particular IP address.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 707/798
Thus the DNS makes it possible
to ping an host by its domain
name by resolving the domain
name into IP address.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 708/798
Thus the DNS makes it possible
to ping an host by its domain
name by resolving the domain
name into IP address.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 709/798
In client side open
the /etc/resolv.conf
file.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 710/798
Mention the
nameserver ipaddress
and domain name here.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 711/798
Thus the DNS makes it possible
to ping an host by its domainname by resolving the domain
name into IP address.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 712/798
It shows the simple
lookup of host,thus itsshow the corresponding
ip address to the
specified fully quailed
domain name.
Using nslookup you canidentifies MX record for
particular domain.
Using nslookup you can
identifies nameserver for
particular domain.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 713/798
Open theforward file.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 714/798
In this file we can add
additional entry MX(mailexchange record ) and its
corresponding ip address
192.168.0.100.
In this file we can add
additional entry station105
machine and its
corresponding ip address
192.168.0.100
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 715/798
Open thereverse file.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 716/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 717/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 718/798
Using nslookup you canidentifies MX record for
particular domain.
Using nslookup you can
identifies address for
particular FQDN.
Using nslookup you canidentifies PTR record for
particular FQDN.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 719/798
Open theconfiguration
file named.conf.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 720/798
Forward zone lists the
name servers outside the
network that should besearched when the
networks name server
fails.
DNS Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 721/798
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 722/798
Apache Web Server • Apache web server:
• The Apache Web server is a free HTTP (Web)server developed by the Apache Server Project.
• It is a reliable, efficient , and easily extensible WebServer
• Free open source code
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 723/798
Important directories and configuration files
Apache Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 724/798
Service profile
Packages - httpd
Configurations file - /etc/httpd/conf/httpd.conf
Daemons - httpd
Portnumber - 80
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 725/798
Query a httpd package
whether installed or not
but the screen shows
httpd packages is notinstalled.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 726/798
Web server configuration
httpd package is
installed using
rpm command.
Now query the
package it show
package is
installed.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 727/798
Open the httpdconfiguration
file.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 728/798
You can see the first page file content, we
need to edit the end part
of the, so press shift+G
in command mode thecursor will bottom of
page.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 729/798
This screen show
end of httpd.conf file.
Web server configuration
Copy the last
seven lines .
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 730/798
Paste the copied
lines here .
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 731/798
In virtual host field we
enter ipaddress or fully
qualified domain
address.
Web server configuration
Here specify the e-mail
address of the
administrator for the
web server.
Here specify the base
directory from which
html files will be
saved..
Here specify the
hostname for your
server.
Now save and quit
the the httpd.conf file.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 732/798
After editing the
configuration file The
service httpd is
restarted.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 733/798
Creating index.html page
and place this file in the/var/www/html/ directory.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 734/798
Let us create
html file .
Web server configuration
After typing save
and quit the file.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 735/798
Open the mozilla web browser and type the
fully qualified domain
name in address bar and
press enter, it will open
corresponding web page.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 736/798
To allow only a
particular user to accessour web site we can
add directory session
inside virtualhost
session.
Web server configuration
Setting up
/var/www/html/ access
control directive .
Directives that can be
overridden by theentries in an .htaccess
file.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 737/798
Create .htaccess file
in /var/www/html/
directory and open
the file
.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 738/798
The authorization realmis given to the client so
the user knows which
username and password
to send.
Web server configuration
Type of user authentication for
directory. only Basic
and Digest are currently
implemented.
This file contain list of
users and passwords for user authentication.
Selects theauthenticated users that
can access a directory.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 739/798
Web server configuration
Set the httpd
password for the user joe .
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 740/798
httpd password is
stored in htpasswd
file.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 741/798
Set full permission for
the htpasswd file to
make sure that the user
has the execute
permission .
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 742/798
To add another user inthe htpasswd file.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 743/798
Restart the httpd
service.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 744/798
Web server configuration
Enter the fully qualified
domain name in address
bar.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 745/798
When we access theweb page the mozilla
will prompts for the
username and password.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 746/798
Web server configuration
Enter the username and
the password.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 747/798
Web server configuration
Now you can see theweb page.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 748/798
Access ControlThe web access can be controlled by using access
control directives such as allow and deny.
Directive Description
deny from hosthost ….
Determines hosts that can access a givendirectory: all, or partial or full domain nameor ip address.
allow from hosthost ….
Determines which hosts can access agiven directory: all, or partial or full domain
name or ip address.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 749/798
This indicates that wecan access the web page
from any network.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 750/798
To access the web page
only from the above
specified network.
Web server configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 751/798
Virtual host
Virtual hosts allow you to host multiple domains from asingle machine.
Apache supports two different type of virtual hosts.
Name-based virtual hosts
Ip-based virtual hosts
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 752/798
Ip and Named-based Virtual Hosts
IP-based virtual hosts
-Ip-based virtual hosts are used when a singlemachine has several different IP address.
-To run a virtual host on each IP address.
Named-based virtual hosts
-It allow you to host many virtual hosts from asingle IP address.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 753/798
Name-based virtual hosts
Here we place two
domains in a single ipaddress and we can
place number of
domains using single
IP address.
Two domains are
used in the name of example and test.com
in a single ip address
192.168.0.20.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 754/798
An ip address is
mentioned in the
virtualhost field.
Name-based virtual hosts
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 755/798
The server
fully qualified
domain name is
described here.
Name-based virtual hosts
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 756/798
described here.
A Directory is created
in the specified path asabove here copy
test.com webpage..
Name-based virtual hosts
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 757/798
Httpd service is
restarted.
Name-based virtual hosts
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 758/798
This is the webpage for
the test.com .
Name-based virtual hosts
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 759/798
This is the webpage for
example.com.
Name-based virtual hosts
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 760/798
p
Squid
It is the proxy caching server used in Linux.
Handles the request from the local clients for
web access.
It supports all popular internet protocols
including FTP, Gopher ad HTTP.
Proxy Server: Squid
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 761/798
Service profile
Packages - Squid
Configuration files - /etc/squid/squid.conf
Daemons - Squid
Port number - 3128
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 762/798
Squid Configuration
Install the
squid package.
Open the squid
configuration file.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 763/798
Squid Configuration
This is the default squid
configuration file if we
want to change the
defaults then we can
edit the file.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 764/798
Squid Configuration
3128 is thehttp port.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 765/798
Squid Configuration
Search for the aclaccess control list
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 766/798
Create another acl namedthano1 to restrict the web
access by time. Thus here the
web server can be accessed
during 18:30-19:30 only.
Squid Configuration
Search for
http_access in
command mode.The specified range of
IP address are allowed
to access the web server
by assigning them in acl
named thano.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 767/798
To allow the access lists
thano and thano1
Squid Configuration
This deny other IPaddresses except the IP
addresses mentioned in
access lists
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 768/798
Now restart thesquid
service.
Squid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 769/798
To set the proxy
get into the mozila
wizard.
Squid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 770/798
Select
preferences to set
the proxy server.
Squid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 771/798
And select the
option proxies.
Squid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 772/798
Enter the IP address
of the proxy server and the port number.
Squid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 773/798
Squid Configuration
Now the time is in between the access time
given in the acl so we
can access web server.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 774/798
Here you can see that
the access is denied
since the we are notallowed to access the
web server in this time.
Squid Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 775/798
Apache can provide encrypted communications using the mod_ssl apache module.
To make use of encrypted communications, a client must request the https protocol.
Encryption is based on either the RSA or DSA algorithm.
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 776/798
Package - mod_ssl
Port number - 443
Certificate - conf/ssl.crt/server.crt
Private key - conf/ssl.key/server.key
Self-signed cert - make testcert
Certificate signature req - make certreq
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 777/798
Query is made to
check whether the
mod_ssl package is
installed. if not,install the packages
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 778/798
To generate the
certificate signature
request.
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 779/798
The self signed certificate
can be installed using the
command
make testcert.
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 780/798
When we restart the
httpd service it will
prompts for the
password.
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 781/798
Open the mozilla browser and type fully
qualified name in the
address bar using https
protocol.
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 782/798
Click here to
view thecertificate.
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 783/798
Here you can view the
certificate informations.
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 784/798
After examining accept the
certificate temporarily or
permanent and then click ok.
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 785/798
You can see a warning
message indicating that
this page can not be
read by a third party.
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 786/798
Now you can access
the web page
securely.
Apache Encrypted Web Server
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 787/798
Sendmail:
Red Hat Linux uses Sendmail as its MTA to deliver messages.
It listens for any mail messages received from other hosts andaddress to user on the network host it serves.
It handles the remote messages, determining the host to be sent.
Sendmail Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 788/798
package - sendmail, sendmail-cf
configuration file - /etc/mail/sendmail.mc
m4 macro config. file - /etc/mail/sendmail.cf
demon service - sendmail
port number - 25(smtp),110(pop)
Sendmail Service Profile
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 789/798
Sendmail Configuration
Query is made to
check whether thesendmail package is
installed. if not, install
the packages.
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 790/798
Installing packages
using rpm command.
Sendmail Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 791/798
Open the sendmail
configuration file .
Sendmail Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 792/798
Sendmail
configuration file.
Sendmail Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 793/798
Now we search for the
text 127.0.0.1 .
Sendmail Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 794/798
The cursor finds the
127.0.0.0 (this line isdefault for mail
transferring only for
local host.
Sendmail Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 795/798
The word dnl is added in
the beginning of this line
to comment.
Sendmail Configuration
commenting this line
voids to send mail to the
other systems
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 796/798
M4 is a macro languagethat can help to configure
the sendmail.cf file, using
sendmail.mc
Sendmail Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 797/798
Open theVirtusertable file, for
mapping user virtual
domain addresses.
Sendmail Configuration
8/14/2019 Linux Slides1 to 800
http://slidepdf.com/reader/full/linux-slides1-to-800 798/798
The virutusertableconfiguration helps to
define the domain name
along with fully
qualified domain name.
Sendmail Configuration