Linux Shell Scripting

Unformatted text preview:

Linux Basics & Shell ScriptingLinux Introduction:Linux is Open Source Operating system developed by a Finnish student LinuS Torvalds in 1991.It is free to download and use.Linux is more reliable Linux is compatible on many h/w like Macs, Mainframes, super computers, cell phones etc.Very resistant to malware such as viruses, spyware etc. What is Operating System:Operating system is the software which acts as the interface between the hardware and the software we want to run on the hardwareEx: Microsoft office is the softwareMicrosoft windows is operating system Laptop/desktop is hardwareEx:Mobile is hardwareExamples of mobile hardware:SymbiosisIosandroid is OSApplication is the software Unix was developed in 1970 by Denis retchi at Bell labs Linux was developed by Linux torwalds in the year 1990.Unix vs Linux Unix is called mother of OS which laid foundation to LinuxUnix is designed mainly for mainframes and is in enterprisesLinux is for computer users, developers, servers Linux is free, Unix is not Unix runs on specific hardware only (AIX on IBM boxes )Linux runs on many h/wLinux ArchitectureLinux has H/w includes HDD RAM CPUKernel Heart of OS, talks to H/w, provides low level services to upper layer components Shell interface between Kernel and userApplications/Utilities – provide most of functions to users.Shell:Shell is the screen that user use to interact with operating system Windows shell is the GUI – click on icons – it is called GUI shell LUI – Line User interface – looks like DOS (Disk Operating system )prompt Type a command and hit enter Line user interface much more powerful With LUI we get prompt to work on .Bash shell is the default shell in LinuxROOT:Like Administrator for windows machine Highest level of user/anything As root anything can be performed In Linux users will have home folders Home directory – is the highest level of any user folder root user – highest userroot directory – highest folder, home directory Capitazalation:Upper case and lower case letters are differentHome/home/hOMe- all are same in windows All are different in case of Linux Because each letter is ASCII character in Linux Same for username Windows is case insensitive, 2 files cannot be created wth names File, file.Linux is case sensitive, 2 files can be created with names File, fileServer vs Desktop:Server version is stripped down version of Linux – no GUI, lot of other tools are not installed automatically, it has what a server needs.Desktop version: gives GUI version of Linux – looks like Windows/Mac.Every distro has desktop and server editions ex: readhat/Ubuntu etcAs a desktop OS, Linux is not best choice.Linux is good for Server configurations.For setting up for website, does need to reboot often.Linux Distributions:People started developing their own code out of kernel developed by LinusSo there are many versions of linux which is called distributions/flavours Example:RedhatUbuntu Google android Fedora CentosEvery distribution has a different purposeTrustix linux – most secure Laptop desktop – Ubuntu Entreprise (On servers )– Redhat linux - customer center to support DSL - very small distro – 53 MB Open source:All open source software is not free (usage is free, support is not free)Everyone is allowed to see the source code Ex: mysql database They will give free software, but support they will charge They get money from support Open source software can be used at home/personal use/ at test labBut cannot be used on production server, we need license to use them.Linux Boot process What happens when a power button is pressed on the server/laptopBIOS – Basic Input Output System – does POST Poweron Self Test – checks whether all i/o devices are working fine (mouse monitor keyboard RAM HDD etc ), searches loads and executesboot loader programMBR – Master boot record :Located in the first sector of bootable disk. ex: /dev/sda or /dev/hdafirst program to be executed in Linux,of 512 bytes,it has 3 components 1)primary bootloader of 446 bytes 2)partition table info in next 64 bytes3) MBR validation check in last 2 bytesSo it loads and executes GRUB into memoryThe Master Boot Record (MBR) is the information in the first sector of any hard disk or diskette that identifies how and where an operating system is located so that it can be boot (loaded) into the computer's main storage or random access memory.The Master Boot Record is also sometimes called the "partition sector" or the "master partition table" because it includes a table that locates each partition that the hard disk has been formatted into. In addition to this table, the MBR also includes a program that reads the bootsector record of the partition containing the operating system to be booted into RAM. In turn, that record contains a program that loads the rest of the operating system into RAM.GRUB – Grand Unified Boot loader - responsible for selecting OS, loads kernel into memoryif multiple OS images are present, one image can be chooses using GRUBGRUB displays a splash screen, waits for sometime, if user does not choose anything, it loads default kernel So it loads and executes Kernel Kernel – executes init programPID 1init Looks at /etc/inittab file to decide run levelRunlevel programs Basic runlevels are:0 – halt1 – Single user mode2 – Multiuser, without NFS3 – Full multiuser mode CLI no graphics with network4 – unused5 – X11 – graphics, multiuser mode with network.6 – rebootRun levels:Run level 0 – /etc/rc.d/rc0.d/Run level 1 – /etc/rc.d/rc1.d/Run level 2 – /etc/rc.d/rc2.d/Run level 3 – /etc/rc.d/rc3.d/Run level 4 – /etc/rc.d/rc4.d/Run level 5 – /etc/rc.d/rc5.d/Run level 6 – /etc/rc.d/rc6.d/Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K.Programs starts with S are used during startup. S for startup.Programs starts with K are used during shutdown. K for kill.There are numbers right next to S and K in the program names. Those are the sequence numberin which the programs should be started or killed.Linux Installation Linux can be installed using CD/USD/using iso image/using network installation like kickstartOr single machine can be installed using iso (which can be downloaded from net)Linux can be installed using isoiso – international standard organizationexample: redhat-7.3-x86_64.ga.isoDirectory structure:/ /root/tmp/dev/ /dev/sda, /dev/sdb /bin//lib/usr/var/etc/home/boot/optiso;RHEL-7.2-x86_64.iso  RHEL OS


View Full Document

Linux Shell Scripting

Download Linux Shell Scripting
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Linux Shell Scripting and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Linux Shell Scripting 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?