Softsmith Infotech Linux OS Concepts. Softsmith Infotech Operating System A program or a software that governs the functioning of other programs Interface.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Introduction to Linux/UNIX. History UNIX beginnings in 1969 (Linus Torvalds is born!) AT & T Bell Laboratories (Ken Thompson & Dennis Richie) Working.
Bash Shell Scripting 10 Second Guide Common environment variables PATH - Sets the search path for any executable command. Similar to the PATH variable.
Unix Presentation. What is an Operating System An operating system (OS) is a program that allows you to interact with the computer -- all of the software.
Linux Commands LINUX COMMANDS.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Overview of Linux CS3530 Spring 2014 Dr. José M. Garrido Department of Computer Science.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Introduction to Shell Script Programming
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
CENT 305 Information Systems Security Linux Introduction.
Hp education services education.hp.com hp education services education.hp.com 1 HP World/Interex 2002 Linux BASH Shell Programming Chris Cooper (734)
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
Operating System - Linux Ph. D. Course Work : PHYS 601 Statistics and Computer Applications Presented By: Sanjay Godara Dept. of Physics & Astrophysics.
Introduction to Linux ( I ) Sidney Fong 4 th Feb 2006.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Session 2 Wharton Summer Tech Camp Basic Unix. Agenda Cover basic UNIX commands and useful functions.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Linux+ Guide to Linux Certification, Third Edition
Linux Operations and Administration
UNIX Shell Script (1) Dr. Tran, Van Hoai Faculty of Computer Science and Engineering HCMC Uni. of Technology
Shell Programming. Introducing UNIX Shells  Shell is also a programming language and provides various features like variables, branching, looping and.
1 System Administration Introduction to Scripting, Perl Session 3 – Sat 10 Nov 2007 References:  chapter 1, The Unix Programming Environment, Kernighan.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Welcome to CS323 Operating System lab 1 TA: Nouf Al-Harbi NoufNaief.net.
Unix/Linux for beginners:
1 Lecture 1 Introduction & Getting Started COP 3353 Introduction to UNIX.
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
Introduction to Programming Using C An Introduction to Operating Systems.
1 © 2000 John Urrutia. All rights reserved. Session 5 The Bourne Shell.
Chapter Six Introduction to Shell Script Programming.
CS252: Systems Programming Ninghui Li Slides by Prof. Gustavo Rodriguez-Rivera Topic 7: Unix Tools and Shell Scripts.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Linux Commands C151 Multi-User Operating Systems.
Agenda Positional Parameters / Continued... Command Substitution Bourne Shell / Bash Shell / Korn Shell Mathematical Expressions Bourne Shell / Bash Shell.
Linux+ Guide to Linux Certification, Second Edition Chapter 4 Exploring Linux Filesystems.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
Learning Unix/Linux Based on slides from: Eric Bishop.
Linux Administration Working with the BASH Shell.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Bash Scripting CIRC Summer School 2016 Baowei Liu CIRC Summer School 2016 Baowei Liu.
Overview of Linux Fall 2016 Dr. Donghyun Kim
CIRC Winter Boot Camp 2017 Baowei Liu
SUSE Linux Enterprise Desktop Administration
Prepared by: Eng. Maryam Adel Abdel-Hady
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Some Linux Commands.
The Linux Operating System
Shell Script Assignment 1.
Introduction to UNIX.
LING 408/508: Computational Techniques for Linguists
Introduction to Linux/UNIX
Linux Shell Script Programming
CSE 303 Concepts and Tools for Software Development
Linux Commands LINUX COMMANDS.
Gulshan Verma Singsys Pte. Ltd.
Presentation transcript:

Softsmith Infotech Linux OS Concepts

Softsmith Infotech Operating System A program or a software that governs the functioning of other programs Interface between User and the Hardware Allocates resources for tasks Allocates tasks to programs Manages space and time Controls the devices

Softsmith Infotech Types of Operating System Tasks –Uni tasking –Multi tasking Users –Single User –Multi User Processing –Uni processing –Multi processing Timesharing

Softsmith Infotech FOSS Free Open Source Software Free – Means Liberty and not related to Price or cost Open – Source code is available and any body can contribute to the development. Organization independent

Softsmith Infotech Kernel Core or nucleus of an operating system Interacts with the hardware First program to get loaded when the system starts and runs till the session gets terminated Different from BIOS which is hardware dependent. Kernel is software dependent

Softsmith Infotech Kernel types Monolithic –All OS related code are stuffed in a single module –Available as a single file –Advantage : Faster functioning Micro –OS components are isolated and run in their own address space –Device drivers, programs and system services run outside kernel memory space –Supports modularity –Lesser in size

Softsmith Infotech Shell Program that interacts with kernel Bridge between kernel and the user Command interpreter User can type command and the command is conveyed to the kernel and it will be executed

Softsmith Infotech Types of Shell Sh – simple shell BASH – Bourne Again Shell KSH – Korne Shell CSH – C Shell SSH – Secure Shell To use a particular shell type the shell name at the command prompt. –Eg $csh – will switch the current shell to c shell To view the available shells in the system, type cat /etc/shells at the command prompt To view the current shell that is being used, type echo $SHELL at the command prompt

Softsmith Infotech 4 Freedoms with FOSS Freedom to run the software anywhere Freedom to study how the programs work. i.e source code will be accessible Freedom to redistribute copies Freedom to improve the software If a software has all these 4 freedoms, then it is a FOSS

Softsmith Infotech Copyleft Termed by Richard Mathew Stallman Liberates information from the proprietary legal encumbrances associated with conventional copyright Copyleft statement: –“Verbatim copying and redistribution are permitted in any medium provided this notice is preserved.”

Softsmith Infotech History Multics – 1964 Unics – 1969 Minix – 1990 Linux – 1991

Softsmith Infotech Multics Multiplexed Information and Computing Service Written in 1964 Timesharing OS Last version was shut down on October 30, 2008 Monolithic kernel

Softsmith Infotech Unics Uniplexed Information and Computing System Later renamed as UNIX Written in 1969 Ken Thompson, Dennis Ritchie were among the developers Multi user, Multi tasking and timesharing Monolithic kernel

Softsmith Infotech Minix Minimal Unix Tanenbaum developed this OS Mainly for educational purpose Unix like OS, implemented with Micro kernel. So the name Minix

Softsmith Infotech Linux Developed in 1991 by Linus Torvalds Used in most of the computers, ranging from super computers to embedded system Multi user Multi tasking Time sharing Monolithic kernel Latest stable version of linux kernel – , released on 24-Dec-2008

Softsmith Infotech Free Software Foundation Founded by Richard Stallman in 1983 Organisation that started developing copylefted programs Project – GNU Project –GNU Not Unix –Recursive expansion

Softsmith Infotech Operating System User 1 User 2

Softsmith Infotech Linux OS

Softsmith Infotech Linux Distributions Redhat Fedora Debian Novell’s SUSE Linux Ubuntu Mandrake Live CDs – Knoppix and more

Softsmith Infotech GNU/Linux Only the kernel is called by the name Linux The rest are the tools developed under GNU Project Hence the name GNU/Linux

Softsmith Infotech Text editors Vi Emacs gEdit kWrite TextPad And more…

Softsmith Infotech Browsers Mozilla –First Open source browser –Released from Netscape group Firefox –High performance, feature rich, standards based web browser Sea Monkey –Integrated web application suite derived from the mozilla source code

Softsmith Infotech File Management Commands mkdir - creating directory – mkdir dirname rmdir – removing directory and its contents – rmdir dirname cd – Change directory – cd dirpath cp – Copying files – cp file1 file2 mv – Moving or renaming files –mv oldfile newfile

Softsmith Infotech File Management – contd.. ln – Creating links between files –ln file1 file2 –Difference between copying files and linking files cp src dst –Contents of src will be present in dst –Changing content in src will not affect contents of dst and vice versa ln src dst –Contents of src will be present in dst –Changing content in src or dst will get reflected in the other file

Softsmith Infotech Commands Help about commands –man, pinfo, info (man >) Viewing file’s content –cat > Viewing users, processes –who – List all Users –who am I – List the current user –pstree – displays all processes running in the system in tree format –ps – displays processes owned by the current user Changing file permission/owner –chmod – changes file permission –chown – changes file owner

Softsmith Infotech Listing files and Emulating Terminal Listing files in a directory –ls – Lists all files in a directory –ls –a – Lists all files (including hidden files) –ls –l – Lists files in a directory along with owner information, permission etc Terminal Emulator –xterm – Generates a terminal –xterm –fg color –bg color –rightbar : Generates a terminal with the specified background and foreground color and a scroll bar on the right side

Softsmith Infotech VI Editor Popular text editor Just type vi > at the prompt and hit the enter key. A new file will be opened Type the contents needed and save To save, press the Esc Key and then press : (colon) w q and then enter To quit with out saving Esc + : + q and then enter

Softsmith Infotech Vi editor Navigation –Left- h –Down- j –Up- k –Right- l –Top of the screen – H (shift + h) //caps lock will not work –Middle of the screen – M (shift + m) –Bottom of the screen – L (shift + l) –$ - End Key, 0 – Home Key Edit Commands –Cut – X, x –Copy – yy, yw –Paste – P, p

Softsmith Infotech Pattern matching grep – GNU Regular Expression Processor Finds the words / patterns matching with the search and displays the line containing the patterns. Search is limited to a file

Softsmith Infotech Redirection and Pipes Redirection –Input redirection wc < file1 – Content of file 1 is given as input for wc command that counts the no of lines, words and characters in a file –Output redirection cat file > newfile – Copies file’s content to newfile. Over writes the existing content cat file >> newfile – Appends the new content to the existing content Pipes –Output of first command is input for the second and so on –who | wc –l – Number of lines in the output of who command will be displayed

Softsmith Infotech C Program in Linux Open a file with extension.c from the command prompt using vi editor –vi hello.c Type the contents and save (Esc : wq!) Compile the file –gcc hello.c Run the executable –./a.out Compile file with output option –gcc –o hello hello.c Run the executable –./hello

Softsmith Infotech Shell Scripting Shell scripting is the most useful and powerful feature in Linux –Minimizes typing of repetitive command –Can schedule jobs to run in the system –Can initiate back up activities for system administration –Similar to batch files in DOS, but more powerful than Batch files

Softsmith Infotech Working with shell script Open a file with extension.sh using vi editor We can type any number of commands that we use to type at command prompt Save the file Execute the file –sh file.sh –./file.sh (if the file has execution permission)

Softsmith Infotech Shell Scripts To Print a line –echo “Hello World” (Prints Hello World in the screen) To read a line –read n (Stores the content entered by user in variable n To Comment a line –# This is a comment –Only single line comment is available. For multi line comment, we need to use # symbol in lines which we want to comment.

Softsmith Infotech Loops For loop for i in //Loops 5 times do Body of the loop done for (( i=0; i<5; i++ )) do Body of the loop done

Softsmith Infotech While Loop while [ condn ] do body of the loop done We need to ensure that the while loop condition is terminated in a finite way

Softsmith Infotech Conditions We can have if, if else, if elif else and case statements (Nested if statements are also possible 1. if [ condn ] then fi 2. if [ condn ] then else fi 3. if [ condn ] then elif [ condn ] then else fi

Softsmith Infotech Conditions (Case) case expr in Option1) stmt ;; Option2) stmt ;; *) stmt ;; esac Every option should be terminated with a double semicolon. Denotes default case Case should be termniated with esac

Softsmith Infotech Comparison For integer comparison we have the following -eq : equal to -ne : not equal to -lt : less than -gt: greater than -le: less than or equal to -ge: greater than or equal to

Softsmith Infotech Comparison For string comparison we have -=: equal to -~=: not equal to For logical operators -a : AND -o: OR

Softsmith Infotech Arrays Initialising an array –A[0] = 10 –A[1] = Hi Using an array –${A[0]} : retrieves 10 Here arrays can contain data belonging to different data types Uninitialised index in arrays will have null value by default

Softsmith Infotech Functions Local Function –Written at the command prompt –Lasts for the current session alone Global Function –Written in.bashrc file –Available as long as the definition is there in.bashrc file Function in shell script –Available with in the file alone

Softsmith Infotech Parameters Sample function Functionname() { echo $1 } Calling function: Functionname Ram Result: Ram

Softsmith Infotech Environment variables We can view the environment variables through set or env command The set command will display all the global functions written by the user The env command displays only the variables and not the functions We can reassign values for the variables either temporarily or permanently –Temporary Type varname=value at the command prompt –Permanent Type varname=value in.bashrc at the root directory

Softsmith Infotech Aliasing Alias – Alternate name for an entity Entity here refers to command We can give another name or alias name for a command either at the command prompt or in the.bashrc file. The former will be temporary and will vanish if the session ends and the latter will be permanent as long as the definition exists in the.bashrc file

Softsmith Infotech Alias and Unalias alias newname=oldname Eg alias copy=cp Then we can use copy in the same way we use cp command Eg copy file1 file2 //copies content of file1 to file2 To remove alias use unalias command unalias copy After this we cannot use copy to perform copying function