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.

Slides:



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

Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Introduction to Linux and Shell Scripting Jacob Chan.
7/17/2009 rwjBROOKDALE COMMUNITY COLLEGE1 Unix Comp-145 C HAPTER 2.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
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.
Sydney Opera House. Week Three Agenda Administrative Issues Link of the week Review week two lab assignment This week’s expected outcomes Next lab assignment.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Week One Agenda IntroductionIntroduction Administrative AnnouncementsAdministrative Announcements Link of the WeekLink of the Week Expected OutcomesExpected.
1 Operating Systems Lecture 3 Shell Scripts. 2 Brief review of unix1.txt n Glob Construct (metacharacters) and other special characters F ?, *, [] F Ex.
Week Three Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment 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.
UNIX and Shell Programming (06CS36) Unit 1 Continued… Shrinivas R. Mangalwede Department of Computer Science and Engineering K.L.S. Gogte Institute of.
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.
Linux Operations and Administration
UNIX Commands. Why UNIX Commands Are Noninteractive Command may take input from the output of another command (filters). May be scheduled to run at specific.
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 Four Agenda Announcements Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems.
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
Week One Agenda IntroductionIntroduction Administrative AnnouncementsAdministrative Announcements Link of the WeekLink of the Week Expected OutcomesExpected.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
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.
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 Three Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment Break-Out Problems.
Week One Agenda IntroductionIntroduction Administrative AnnouncementsAdministrative Announcements Link of the WeekLink of the Week Expected OutcomesExpected.
Introduction to Programming Using C An Introduction to Operating Systems.
Sydney Opera House. Week Three Agenda Administrative Issues Link of the week Use of the Virtual Machine Review week two lab assignment This week’s expected.
CS252: Systems Programming Ninghui Li Slides by Prof. Gustavo Rodriguez-Rivera Topic 7: Unix Tools and Shell Scripts.
Week Three Agenda Administrative Issues Link of the week Review week two lab assignment This week’s expected outcomes Next lab assignment Upcoming deadlines.
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.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
Week Three Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment Break-Out Problems.
Sydney Opera House. Week Three Agenda Administrative Issues Link of the week Use of the Virtual Machine Review week two lab assignment This week’s expected.
Week One Agenda IntroductionIntroduction Administrative AnnouncementsAdministrative Announcements Link of the WeekLink of the Week Expected OutcomesExpected.
Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming.
Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming.
Week Five Agenda Link of the week Review week four lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
Week Four Agenda Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
1 Week 8 Creating Simple Shell Scripts. 2 Chapter Objectives  In this chapter, you will :  Learn how to create Shell Scripts  Commenting / Making Portable.
Learning Unix/Linux Based on slides from: Eric Bishop.
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.
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.
Introduction to Scripting Workshop February 23, 2016.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Getting started with CentOS Linux
Week Two Agenda Announcements Link of the week Use of Virtual Machine
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Week Three Agenda Link of the Week Review Week Two Information
Part 1: Basic Commands/Utilities
Some Linux Commands.
C151 Multi-User Operating Systems
Sydney Opera House.
Shell Script Assignment 1.
Unix Operating System (Week Two)
INTRODUCTION TO UNIX: The Shell Command Interface
Week Three Agenda Link of the Week Review Week Two Information
Getting started with CentOS Linux
Linux Shell Script Programming
Presentation transcript:

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 Announcements Break Out Problems Upcoming Deadlines Lab assistance, questions and chat time

Announcements Class participation Class participation is an essential element in this class. Many times a student’s final grade borderlines the next highest grade. The score closeness could be.5 to 1. It is the instructors discretion based on the students performance in class, as to whether the next highest grade is given. Convince me professionally, that you want an “A” in this course.

Link of the week The link below lists most all operating systems that are available. The link below has tabs for books, posters, software, and tools Definition of Operating System (OS) Common operating systems are: UNIX, Linux, HP-UX Basic tasks performed by an operating system –Control and allocate memory –Prioritize system requests –Control input and output devices –Facilitate networking and management file systems

Link of the week Services Operating System (OS) perform –Process management –Memory management OS coordinates various types of memory –File systems –Networking –Graphical user interface (GUI) and command line –Device drivers –Security Internal management External management

Use of the Virtual Machine Knoppix features Demonstrate how to ftp a file from Knoppix software to the cs.franklin.edu (Einstein) machine using VMware software Open two Konqueror windows Enter the ftp protocol in one screen Open a Konsole screen and create a file to transfer to the cs.franklin.edu machine.

Review week one lab assignment Basic vi editor commands. vi test_file.txt ^ (place cursor on beginning of line) $(place cursor at end of line) o (insert text - alpha character) cw (change an entire word in a file) Esc key (exit insert mode) :wq! (save text entered in file) :q! (quit without saving changes)

Review week one lab assignment less command q (terminates pagination) Enter or Return key (advance one line) Space bar (refresh full screen) Location of weekly Power Point presentations: _Live File format: Week_Two_2_ppt.ppt Week_Two_2.pptx

Review week one lab assignment if [ ] then Action statements fi while [ ] do Action statements done for file_name in * do Action statements done

Review week one lab assignment #!/bin/ksh if [ $# -ne 1 ] # Verify that there is one command line argument. then Action statements exit elif [ $1 -le syntax ] # Verify that the argument value is greater than zero then Action statements fi while [ $variable -gt 0 ] # Argument value must be greater than zero. do printf $variable if [ $variable -gt 1 ] # If the value doesn’t equal one, output a comma then Action statements fi VARIABLE=$(( $VARIABLE - 1)) done print

Review week one lab assignment #!/bin/ksh # Verify that there is only one argument on the command line if [ $# syntax1 ] then echo "Error. Can only use 0 or 1 arguments." echo "Usage: maxlines.sh [directory]." exit 1 fi flag=1

Review week one lab assignment # If the number of positional parameters is equal to zero search through # the current directory. No directory provided on the command line. Case #1 :./maxlines.sh if [ syntax -eq 0 ] then for testfile in * # Loop through the entire directory (top to bottom) do if [ -f $variable ] # Test that the name is a file then linetest1=`wc -l < $variable` if [ $flag -eq 1 ] then startline=$linetest1 startfile=$testfile flag=2 fi

Review week one lab assignment #The script executes the following code after the first pass if [ $startline -lt $linetest1 ] then startline=$linetest1 startfile=$testfile fi done echo "File $startfile has the most lines with $startline lines." exit 0 fi Case #2:./maxlines.sh /bin

Review week one lab assignment Case #1:./printnum.sh

Review week one lab assignment Case #1: Current directory maxlines.sh /~dandrear/itec400/homework printnum.sh maxlines.sh Case #2: Different directory maxlines.sh /bin cat chmod cp grep

Review week one lab assignment man (uses the “less” command for pagination) ls –l ps ls -a cut –c 1-7 wc -l $# date exit 0 exit 1 NUMBER=$2 echo $NUMBER less

Review week one lab assignment cp file1 file2 mv file1 file2 rm file_1 rmdir dir_1 clear head tail pipes who myArray[1]=$1 more ps –ef

Review week one lab assignment grep find ls ls –a mkdir cd $1 $1, $2, $3 cat chmod mv

Review week one lab assignment sleep diff cd sort umask who who am i

Weeks 2 and 3 expected outcomes Upon successful completion of this module, the student will be able to: Create scripts using shell variables and program control flow. Use man page system and find script tools. Use redirection and pipes to combine scripts and executables.

Next lab assignment In a Unix environment, the commands you enter are executed by a program called the "shell". The user must select a command shell used to communicate with UNIX. One of the things that makes the UNIX system so flexible is its layered design. At the core is the hardware. The hardware is surrounded by system software that most users never interact with called the kernel. The kernel is surrounded by programs (often called utilities) such as cat, date, and diff, that perform specific tasks. A program that provides easy access to these utilities and the kernel by the user is called a shell.

Next lab assignment A shell enables the user to interact with resources of the computer, such as programs, files, directories, and devices. An interactive shell acts as a command interpreter. In its role as a command interpreter, the shell is the interface between the user and the system. The user enters text commands to the shell, and the shell carries them out, usually by running programs.

Next lab assignment Most shells can also be used as a programming language. Users can combine command sequences to create new programs. These programs are known as shell scripts. Shell scripts automate the use of the shell as a command interpreter. The first line of any script must begin with #!, followed by the name of the interpreter. Examples: #!/bin/ksh #!/bin/bash #!/usr/bin/perl Demonstrate: cat /etc/shells echo $SHELL

Next lab assignment Concentric Circle Relationship

Next lab assignment drwxrwxrwx permissions (directory) -rwxrwxrwx permissions (file) lrwxrwxrwx permissions (symbolic link) -rwx dandrear faculty (hard link) exit Each command has a return value. 0 indicates normal exit 1 indicates failed exit The return value of a command can be used with conditional or iteration commands.

Next lab assignment Users can connect the standard output of one command into the standard input of another command by using the pipeline operator (|). Demonstrate: ps -ef ps –ef | wc –l ps –ef | awk ‘{print $2}’ ps –ef | grep dandrear ls –l | cut –c1-3 who –b (time of last system boot) who –d (print dead processes) who –r (print current run level).

Next lab assignment A process associates a number with each file that it has opened. This number is called a file descriptor. When you log in, your first process has the following three open files connected to your terminal. Standard input: File descriptor 0 is open for reading. Standard output: File descriptor 1 is open for writing. Standard error: File descriptor 2 is open reading.

Next lab assignment Linux command documentation is known as “man”. Each page is a self-contained document. The Manual sections are split into eight numbered sections: 1 General commands. 2 System calls 3 C library functions 4 Special files (usually devices, those found in /dev) and drivers. 5 File formats and conventions 6 Games and screensavers 7 Miscellaneous 8 System administration commands and daemons

Next lab assignment The grep command searches the named input file(s) for lines containing a given pattern. Normally, each line found is reported to standard output. Demonstrate: grep text ~dandrear/Winter08_solutions/foobar grep pattern foobar_1 grep pattern * The find command lists all pathnames that are in each of the given directories. Demonstrate: find / -type d –print find ~dandrear –type d -print find. –print find / -name foobar

Next lab assignment Redirect the standard output of a command to a file. date > /tmp/date_saved Redirect the standard input of a command so that it reads from a file instead of from your terminal. cat < ~dandrear/Winter09_solutions/test.txt Append the standard output of a command to a file. cat foobar_2 >> foobar_1

Next lab assignment The coding and testing process Code one small script function at a time. Test that function before adding more code to the script. Program coding is an iterative process (code,test,code,test,code,test, …).

Break Out Problems 1.ps | wc –l 2.who | awk ‘{print $1}‘ | sort –u | wc –l 3.ps –ef | awk ‘{print $1}’ | sort –u | wc –l 4.sort –r names.txt 5.ps –ef | awk ‘{print $9, $1}’ 6.find /bin -name gzip 7.find /etc -name motd 8.> newfile 9.rm newfile 10.date | cut –c nohup grep This ~dandrear/Summer09_solutions/report.txt & 12.cp test_data.txt ~dandrea/temp 13.mv test_data.txt ~dandrear/temp 14.printf $NUMBER

Upcoming Deadlines Lab Assignment 1-1, Obtain a Proctor for Exams, due September 20, Lab Assignment 1-2, Install VMware and Knoppix Virtual Machine, due September 13, 2009 Lab Assignment 1-3, Introduction to Linux, due September 13, Lab Assignment 2-1, Simple Shell Scripting, due September 27, Lab Assignment 3-1, Advanced Scripting, due October 4, Read Module 2 for this week and week three.

Upcoming Deadlines Read pp in Chapter 14, and pages in the Appendix of Essential System AdministrationEssential System Administration Read the following articles: A Basic UNIX Tutorial The Unix Shell Guide sections on the Bourne and C shells

Lab assistance, questions and answers Questions Comments Concerns After class I will help students with their scripts.