You are on page 1of 29

LINUX

OPERATING SYSTEM

DEFINITION
 Operating System is a collection of programs that coordinates the operation of computer
hardware & software.

FUNCTIONS OF OPERATING SYSTEM


 Process Management
 Memory Management
 Data Management
 I/O Management
LINUX ARCHITECTURE

Other Programs

Shell

Kernel

Hardware
KERNEL

 A set of functions that make up the heart of an OS


 It is used to provide an application interface between programs and physical devices.
 Services provided by the kernel
 Controls execution of processes.
 Scheduling of processes.
 Allocating memory.
WHAT IS SHELL ?

 Shell is the interface between the user and the kernel.


 Services provided by the shell
 It interprets all the commands to the kernel
 The kernel after processing the commands gives back to the shell.
LINUX ARCHITECTURE WORKS

USER

C Shell
Korn
Borne Shell
KERNEL Shell
Shells

TC
Shell

HARDWARE
LINUX DISTRIBUTION
FEATURES OF LINUX
 Open Source
 Multitasking
 Multi-User
 Portable
 Scalability
 Reliability
 Biggest servers on this planet running Linux without single second of downtime from last 10yrs
 Security
 Inbuilt firewall (Iptables)
FILE SYSTEM HIERARCHY

root boot bin var etc tmp media

home sbin usr dev mnt opt lib


/root

This Directory is called as ‘root’ Directory.


It is the top of the file system structure.
All other Directories are mounted under it.
This is the default home directory of administrator (i.e., root).

/home

It contains all users home directories.

/boot

This Directory contains the Kernel, the core of the operating system.
This also contains the files related to booting the system such as the boot loader and the initial ram
disk.

/sbin

It contains administrative commands used by super user.


/bin
This Directory contains command used by the superuser and the normal users.
/usr
It contains the programs and applications which are available for users (similar to program files on
windows)
/var
It contains variable information , such as logs and print queues.
/dev
This Directory contains devices nodes through which the operating system can access hardware
and software devices on the system.
/etc
It contains all configuration files.
/mnt
This Directory can be used for manual mounting, since it is initially empty.
/tmp
This Directory contains temporary files used by the system

/opt
It contains the third party applications
ex:- Corel Word Perfect
Sun Star Office

/media
It contains default mount points of removable media such as cdrom, floppy disk, pendrive.

/lib
It contains libraries need by number of different applications as well as Linux kernel.
DISK MANAGEMENT

To view total free space of a disk


[root@comp1 ~]#hwbrowser &

To view free space of partition


[root@comp1 ~]#df -h

To view used space of a partition


[root@comp1 ~]#du -sh LABEL

To know blocksize of a partition To assign label


[root@comp1 ~]#blockdev --getbsz <partition> [root@comp1 ~]#e2label <partition> <label_name>

To view existing label


[root@comp1 ~]#e2label <partition>

To see mounted partition with Label


[root@comp1 ~]#mount -l
What is LVM ?
LVM is a method of allocating hard drive space into logical volumes that can be easily resized
instead of partitions.
With LVM, the hard drive or set of hard drives is allocated to one or more physical volumes.
The physical volumes are combined into volume groups.
Each volume group is divided into logical volumes, which are assigned mount points such as
/home and / and file system types such as ext3,ext4.
Steps to configure LVM ?
Create physical volumes from the hard drives.
Create volume groups from the physical volumes.
Create logical volumes from the volume groups and assign the logical volumes mount points.
LOGICAL VOLUME GROUP
IMPLEMENTING LVM
Create Physical Volume from previously created partitions
[root@comp1 ~]# pvcreate /dev/hda9 /dev/hda10
/dev/hda11
To see the physical volume details
root@comp1 ~]# pvdisplay |less Create Logical Volume
Creation of Volume Group root@comp1 ~]# lvcreate -L <size> <VG name> –n
[root@comp1 ~]# vgcreate <VG name> <PV1> <PV2> <volume name>
To get the information about Volume Group Resizing Logical Volume
root@comp1 ~]# vgdisplay <VG name> [root@comp1 ~]# lvresize -L +sizeM LVname
Removing Logical Volume
root@comp1 ~]# lvremove LVname
Resizing Volume Group
root@comp1 ~]# vgextend VGname PVname
RPM’S RPM Pattern

RPM is the acronym for RedHat Package


Manager. Xmms - 1.2.10 – 9 . i386 . rpm
By using RPM utility the user can install
the new packages, can upgrade and can
also remove existing packages.
Version Extension
Number of RedHat

Package Type of
Name Architecture
METHODS OF INSTALLATION
Standalone Method
Installing through Hard-disk, CD, DVD or Pendrive
Network Installation Method
 NFS
RPM - Remove
 FTP

To remove the existing RPM package


[root@comp1 ~]#rpm <options> <package name> --nodeps

Options :
-e - To uninstall the package from the system
--nodeps - To uninstall package even if dependencies are there.
RPM Options
To query the RPM Package
[root@comp1 ~]#rpm <options> <package name>

Options :
-q - To query the availability of installed package.
-qa - Queries all installed RPM’s in OS. Does not require any package specification.
-qc - Lists only the configuration files stored in the queried RPM.
-qd - Lists only the documentation files stored in the queried RPM.
-qi - Displays complete information about the queried RPM.
-qs - Displays the states of files in the queried RPM.
-ql - Display all the files related to the queried RPM.
Network Installation Methods - NFS

Create a Mount Point


[root@comp1 ~]#mkdir /mnt/pkgs
Mount NFS file system on mount point
[root@comp1 ~]#mount
<serverip>:/var/ftp/pub/Server /mnt/pkgs
To install the RPM package
[root@comp1 ~]#cd /mnt/pkgs
[root@comp1 ~]#rpm -ivh <package>* --force

Network Installation Methods - FTP To install the RPM package


[root@comp1 ~]#rpm -ivh
ftp://<serverip/pub/Server/><package>* --force
BASIC COMMANDS

Print Working Directory


[root@comp1 ~]# pwd
Shows list of files & directories
[root@comp1 ~]# ls <options> <arguments>
Listing of files and directories with size in human readable format
[root@comp1 ~]# ls –lh

Listing of the attributes of a particular file or directory


[root@comp1 ~]# ls -ld <directory / filename>
Shows the list of files in Tree structure
[root@comp1 ~]# ls -R <directory>
LS COMMAND
CREATION OF FILES

By using three methods we can create files


 cat command
 touch command
 vi editor

Displaying & Creating Text Files


[root@comp1 ~]# cat <options> <arguments>
CAT COMMAND
To create a file
[root@comp1 ~]# cat > <filename>

To view the content of a file


[root@comp1 ~]# cat <filename>

To append a file
[root@comp1 ~]# cat >> <filename>

To transfer the contents of file1 & file2 to file3


[root@comp1 ~]# cat <file1> <file2> >> <file3>
TOUCH COMMAND

To create a file with zero bytes as well as to To create nested directories


change the time stamp of file or directory. [root@comp1 ~]# mkdir -p <dir1>/<dir2>/<dir3>
[root@comp1 ~]# touch <filename>
To change the directory
To create multiple files [root@comp1 ~]# cd <path of the directory>
[root@comp1 ~]# touch <file1> <file2> <file3>
To change directory one level back
To create a directory [root@comp1 ~]# cd ..
[root@comp1 ~]# mkdir <directory name>
To change directory two levels back
To create multiple directories [root@comp1 ~]# cd ../..
[root@comp1 ~]# mkdir <dir1> <dir2> <dir3>
HELP COMMANDS

To view manual pages To view info pages


[root@comp1 ~]# man <command> [root@comp1 ~]# info <command>
MONITORING PROCESS
Process:
A program in execution is called process.
Type of Process:
a) Interactive Process
b) System Process
c) Automated Process
Command to monitor process :
#ps
#ps –au
#ps –elf
#top
Killing a process :
#kill -9 <pid of the process>
LOGS IN LINUX
Unix systems have a very flexible and powerful logging system which records every activity of
the system as logs to retrieve the information to troubleshoot and analyze system activity

The logging facility called syslog

Deamon for syslog in RHEL6 is rsyslog


Configration file : /etc/rsyslog
Log files location : /var/log/

Examples:

/var/log/messages,/var/log/dmesg,/var/log/btmp etc
THANK YOU

You might also like