38

Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Embed Size (px)

Citation preview

Page 1: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming
Page 2: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

AgendaAgenda• Introduction• Administrative Announcements• Link of the Week• Expected Outcomes• This Week’s Topics• Next Week’s Lab Assignment• Break Out Problems• Upcoming Deadlines• Lab assistance, questions, and chat time

Page 3: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

IntroductionIntroduction

Instructor: Professor Bob D’AndreaProfessor Bob D’AndreaSoftware Engineer Software Engineer Instructor at Franklin University since 2004Instructor at Franklin University since 2004 Phone No. Phone No. 614.898.0457614.898.0457Cell No. 616.519.5853Cell No. [email protected]@franklin.edu

Program Chair of Information and Technology: Mr. Todd WhittakerMr. Todd WhittakerPhone # 614.947.6110Phone # [email protected]@franklin.edu

Page 4: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Administrative AnnouncementsInstructor commitment

Respond daily to student emails.Respond daily to student emails.Post exam and lab assignment grades as quickly as possible Post exam and lab assignment grades as quickly as possible in student grade books.in student grade books.Post student midterm and final exam status on the Post student midterm and final exam status on the Announcement page after each exam has been received from Announcement page after each exam has been received from the Student Learning Center (SLC).the Student Learning Center (SLC).

Office hoursMonday through Friday: 9:00 AM – 9:00 PMMonday through Friday: 9:00 AM – 9:00 PMSaturday and Sunday: 12:00 AM – 6:00 PMSaturday and Sunday: 12:00 AM – 6:00 PM

Personalized Franklin Live session can be scheduled with a Personalized Franklin Live session can be scheduled with a student(s) needing individual assistance.student(s) needing individual assistance.

Page 5: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Administrative AnnouncementsCourse Web Site

Were students able to read my comments in the Class Communication icon?

AttendanceEmail and/or call me if you are unable to attend class. Otherwise, you will be marked “Not Present” and you will receive an email notice.

cs.franklin.edu serverEveryone will need a login to the cs.franklin.edu machine?Everyone will need a login to the cs.franklin.edu machine?Putty is the prescribed open source interface for this class. You Putty is the prescribed open source interface for this class. You will use putty to access the cs.franklin.edu machine. Student lab will use putty to access the cs.franklin.edu machine. Student lab assignments will be tested under your itec400/homework directory.assignments will be tested under your itec400/homework directory.

Page 6: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Administrative AnnouncementsAdministrative AnnouncementsRecorded Franklin Live Power Point Presentations

http://cs.franklin.edu/~dandrear/itec400/Summer_2013_UNIX_Presentationshttp://cs.franklin.edu/~dandrear/itec400/Summer_2013_UNIX_Presentations

Franklin Live file name format:Franklin Live file name format:-rwx---r-x 1 dandrear faculty 1067008 Apr 3 21:53 -rwx---r-x 1 dandrear faculty 1067008 Apr 3 21:53 Week_One_1_UNIX_ppt.pptWeek_One_1_UNIX_ppt.ppt

-rwx---r-x 1 dandrear faculty 887795 Apr 3 21:54 -rwx---r-x 1 dandrear faculty 887795 Apr 3 21:54 Week_One_1_UNIX.pptxWeek_One_1_UNIX.pptx

Each week, the Power Point presentation used in the Franklin Live session will be available on Monday mornings for printing and/or review prior to the online session.

Page 7: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Administrative AnnouncementsAdministrative AnnouncementsEmail format for completed lab assignments

Email a notification when an assignment is completed and Email a notification when an assignment is completed and ready to be graded. The “Subject” line of your email ready to be graded. The “Subject” line of your email notification should have the following format:notification should have the following format:

<User name> <Section Number> <Lab Assig 1-3><User name> <Section Number> <Lab Assig 1-3>Example: Example: dandrear V1WW Lab Assign. 1-3dandrear V1WW Lab Assign. 1-3

Email format for questionsEmail format for questions<User name> <Section Number> <Question(s)><User name> <Section Number> <Question(s)>

Example: Example: dandrear V1WW Question(s)dandrear V1WW Question(s)Scripts and text file suffixScripts and text file suffix

All scripts and text files shall end with a suffix (e.g. ,sh, .pl, .txt and .cgi).All scripts and text files shall end with a suffix (e.g. ,sh, .pl, .txt and .cgi).

Homework assistance:Homework assistance:Do not solicit help from the Internet for lab assignments. If Do not solicit help from the Internet for lab assignments. If caught soliciting assistance from the Internet, Franklin caught soliciting assistance from the Internet, Franklin University will take action against you.University will take action against you.

Page 8: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Administrative AnnouncementsAdministrative Announcements

Drop Box::Deposit all lab assignments in the Drop Box. The Deposit all lab assignments in the Drop Box. The

Drop Box is located under your Franklin University Drop Box is located under your Franklin University course Web page “Communications” tab.course Web page “Communications” tab.

Student drop box documentation link belowStudent drop box documentation link belowhttp://online.franklin.edu/forms/StudentDropBoxManual.dochttp://online.franklin.edu/forms/StudentDropBoxManual.doc

/home/user name/itec400/homeworkThis directory is where your scripts and text files are graded. This directory is where your scripts and text files are graded.

Page 9: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Administrative AnnouncementsAdministrative Announcements

Turnitin.com AssignmentsThe Light Directory Access Protocol (LDAP) and Public Domain/Open Source lab assignments must be submitted to Turnitin.com. Your report will be verified by Turnitin.com for author originality. If Turnitin.com indicates that your percentage of originality is 45 percent or greater, I will not grade the paper. I will recommend that you seek assistance from the Student Learning Center (SLC).

Page 10: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Administrative AnnouncementsAdministrative AnnouncementsUNIX System Administration Syllabus

Optional Materials Tutorials: Refer to the following web sites throughout UNIX System Administration. They are excellent resources for UNIX and Linux: • UNIX System Administration Independent Learning (USAIL) (NO LONGER AVAILABLE)http://web.archive.org/web/20080206003854/http://www.uwsg.indiana.edu/usail/

• Linux help, tutorials and tips • UNIX Tutorial for Beginners • UNIX help for Users.

Page 11: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Administrative AnnouncementsAPA style format:

Your writing assignments will be graded on citing Your writing assignments will be graded on citing sources, spelling, punctuation, and capitalization. All sources, spelling, punctuation, and capitalization. All reports must have a cover and reference page.reports must have a cover and reference page.

Link of the week:New links are provided weekly to direct students to New links are provided weekly to direct students to

information on the Internet that will aid them with class information on the Internet that will aid them with class lab assignments and enhance their overall learning lab assignments and enhance their overall learning experience.experience.

Tutoring and workshops::Student Learning Center (SLC)Student Learning Center (SLC)Writing appointments via Franklin LiveWriting appointments via Franklin Live

Page 12: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Administrative Announcements VMware software:

You should receive a Live CD with Knoppix 5.1.1 You should receive a Live CD with Knoppix 5.1.1 recorded on it from Franklin University. If you do recorded on it from Franklin University. If you do not receive this CD, call the Helpdesk. The Knoppix not receive this CD, call the Helpdesk. The Knoppix software can also be downloaded from the course software can also be downloaded from the course site. site.

Creating scripts using Knoppix software:

ftp from your Knoppix software to cs.franklin.eduftp from your Knoppix software to cs.franklin.edu

sftp://[email protected]/home/dandrearsftp://[email protected]/home/dandrear

Page 13: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Link of the WeekLink of the WeekOpen Source Software:

• http://en.wikipedia.org/wiki/Open_sourcehttp://en.wikipedia.org/wiki/Open_source• http://freshmeat.nethttp://freshmeat.net• http://sourceforge.nethttp://sourceforge.net

Page 14: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Link of the WeekLink of the WeekOpen Source Software:

Definition of Open Source Software.Definition of Open Source Software.• Distributed in source code formatDistributed in source code format• Developed in a public, collaborative mannerDeveloped in a public, collaborative manner• Software is free of chargeSoftware is free of charge• Allows anyone to create modifications to the Allows anyone to create modifications to the

software, port it to new operating systems and software, port it to new operating systems and processor architecturesprocessor architectures

Who benefits from open source products?Who benefits from open source products?

Page 15: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Expected OutcomesExpected OutcomesUpon successful completion of this course, students will be Upon successful completion of this course, students will be

able to:able to:

• Create non-trivial shell scripts. Create non-trivial shell scripts.

• Perform appropriate UNIX System Administration tasks. Perform appropriate UNIX System Administration tasks.

• Compose non-trivial scripts using Perl programming Compose non-trivial scripts using Perl programming language. language.

• Distinguish the roles of Linux and Open Source software. Distinguish the roles of Linux and Open Source software.

• Incorporate the make utility appropriately within Incorporate the make utility appropriately within programs. programs.

• Create an open source presentation of your choice.Create an open source presentation of your choice.

• Create a CGI scriptCreate a CGI script

Page 16: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Basic UNIX PrimerBasic UNIX PrimerUNIX comes in a variety of constantly changing flavors (SUNOS, HPUX, BSD and Solaris, just to name a few). Each of these UNIX types will have small variations from all of the others. This may seem a bit discouraging at first, but in reality each version of UNIX has more in common with all of the others than differences. The ls command, for example, will give a listing of the current directory in any UNIX environment. The changes or semantics local to any particular brand of UNIX should be explained in the manual pages that come with that particular system. .

Page 17: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Basic UNIX PrimerBasic UNIX Primer The purpose of this explanation is not to explore the differences between different UNIX flavors, but rather to assume that they are all equivalent and look at how the different shells behave.

Page 18: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

UNIX CommandsUNIX CommandsThe UNIX operating system comes with many commands that allows the user to interact with their computer. UNIX commands are simply programs that are executed when called for. The usual place for the storage of these commands is the /usr/bin directory. The commands that are available on a particular machine will vary. There is a set number of standard commands that come with a UNIX system, but there is no limit to the commands that can be made available.

Page 19: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

What is a shell?What is a shell?A shell is an entity that takes input from the user and deals with the computer rather than have the user deal directly with the computer. If the user had to deal directly with the computer he would not get much done as the computer only understands strings of 1's and 0's. While this is a bit of a misrepresentation of what the shell actually does (the idea of an operating system is neglected) it provides a rough idea that should cause the reader to be grateful that there is such a thing as a shell. A good way to view a shell is as follows. When a person drives a car, that person doesn't have to actually adjust every detail that goes along with making the engine run, or the electronic system controlling all of the engine timing and so on. All the user (or driver in this example) needs to know is that D means drive and that pressing accelerator pedal will make the car go faster or slower. The dashboard would also be considered part of the shell since pertinent information relating to the user's involvement in operating the car is displayed there.

Page 20: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

What is a shell?What is a shell?In fact any part of the car that the user has control of during operation of the car would be considered part of the shell. I think the idea of what a shell is coming clear now. It is a program that allows the user to use the computer without him having to deal directly with it. It is in a sense a protective shell that prevents the user and computer from coming into contact with one another.

Page 21: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Command Line ParsingCommand Line ParsingTo parse a command line means to look at each part of the command line and convert it into something that the computer can execute. Since there variations in how different shells parse a command line, it can be assumed that the shell in question is generic. When a user enters a command line at the prompt, the shell begins by analyzing the command line. The shell will break the command line down into small indivisible pieces called tokens (sometimes they are referred to as atomic).

Page 22: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Command Line ParsingCommand Line ParsingEach token is then analyzed in terms of its relationship with the other tokens. This is similar to the human examination of an English sentence. If a noun is present, but no verb, the sentence is deemed incomplete. The shell behaves in much the same matter. It doesn't only check for missing bits, it also makes sure that what is there is in correct order. The shell may have to examine a command line more than once to collect all of the tokens. Each examination is called a pass. The reason for multiple passes is that command lines can be quite complicated, there can be all kinds of substitutions that need to be made.

Page 23: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Command Line ParsingCommand Line ParsingOn each pass the shell will make a required substitution and then collect the available tokens. Since the substitutions can be nested (substitutions containing substitutions), the shell may require several passes to collect all of the tokens. As stated above, if at this point in the process the shell determines that the grammar of the command line is incorrect, an error is displayed to the user, or else the command is executed. While the actual order in which the tokens are gathered is interesting, it is beyond the scope of this course. Where required (such as aliases) the order of some of the parsing procedure will be presented.

Page 24: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Command Line ParsingCommand Line ParsingThere are two types of arguments, OPTIONS and PARAMETERS. Options come right after the command name and consist of a – (minus sign character) followed by a letter. Parameters come after the options. The example :

ls –l file1 file2 file3ls –l file1 file2 file3

Page 25: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Review Shell syntaxReview Shell syntaxShell VariablesOne of the ways the shell lets you customize your working environment is by using shell variables. A shell variable is an item, known by a name, that represents a value of some type. As the term “variable” implies, the value of a shell variable can be changed.There are two types of shell variables. First, there are variables that act as off/on switches. Second, there are variables that store a particular value as a string of characters.

Page 26: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Review Shell syntaxReview Shell syntaxShell Set Command

Debugging part of a script:Debugging part of a script:

set -x # activate debugging set -x # activate debugging # your commands go here...# your commands go here...set +x # stop debugging set +x # stop debugging

Page 27: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Review Shell syntaxReview Shell syntaxShell Set Command

set -A is Korn Shell (ksh) specific (not set -A is Korn Shell (ksh) specific (not available in Bash or POSIX SH) and it available in Bash or POSIX SH) and it initializes an array with the specified value(s).initializes an array with the specified value(s).

$ set -A COLORS "red" "green" "blue" $ set -A COLORS "red" "green" "blue"

$ print ${COLORS[0]} $ print ${COLORS[0]}

red red

$ print ${COLORS[1]} $ print ${COLORS[1]}

green green

$ print ${COLORS[2]} $ print ${COLORS[2]}

blueblue

Page 28: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Review Shell syntaxReview Shell syntax• $# - Number of positional parameters• $! - Background PID• $? - Return value• $$ - Process PID• $ - Provides the content of a variable ($NUMBER)• $0, $1, $2, $3 … - This syntax represents the

positional parameters on the command line../printnum.sh 4

• exit 0 – The return values is a number from 0 to 255. A value of zero (0) indicates a normal exit.

• exit 1 - Indicates a failure occurred.

Page 29: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Review shell syntaxReview shell syntax• “ “ - Double quotes. Removes special meaning of all

enclosed characters, except $, `, “, and \.• Example: print “The price is $Price.\n”; (interpolation)• ‘ ’ - Literal quotes. Removes the special meaning of all

enclosed characters. A single quote cannot appear within single quotes because a single quote denotes the end of the string.

• ` ` - Single Back-Tic quotes. Used for command substitution.

• Example: echo The date is `date` (interpolation)• LINES=`wc -l $ENTRY | cut -c 1-7`• LISTING=`ls -l | cut -f 9`

Page 30: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Review Command Structure• if [ -d "$1" ]

then

action statement

fi

• wc –l - Word count with –l (line option). Print the new line counts

• ~ - Tilde (~ means /home/dandrear)

• for name in *

do

action statements

done

Page 31: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Review Command Structure• while [ condition]

do

action statement(s)

done

• if [ condition ]

then

action statement(s)

fi

Page 32: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Review Command Structure• for name in *

do

action statements

done

Example:

while [ "$1" != "" ]

do

# Store the value zero (0) in the variable size.

$size = 0

done

Page 33: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Review Command StructureExamples:

if [ $# –ne 1 ]

then

echo “Please enter a command line argument”

fi

logfile="/var/adm/messages"

foreach mon in Sun Mon Tue Wed Thu Fri Sat

do

grep $mon $logfile > $logfile.$mon

end

Page 34: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Next Weeks Lab AssignmentNext Weeks Lab Assignment• Review Lab Assignment 2-1 Simple Shell scripting.

• Lab assignments should be recorded on cs.franklin.edu (Einstein) machine in your “~/itec400/homework” directory.

• Demonstrate how to create a file using the “vi” editor.

• Execute printnum.sh and maxlines.sh scripts on the cs.franklin.edu machine.

• Lab Assignment 2-1 will be complemented with script logic. Script logic will be utilized to jump start the lab assignment. It contains script logic, 70% percent of the needed coding, and helpful hints to assist your programming skills. In addition to script logic, you will receive a Shell and Perl Commands Quick Reference document in email.

Page 35: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Break Out ProblemsBreak Out Problems1. Program statement (#!/bin/ksh)2. less3. ps –ef | wc –l4. who | awk ‘{print $1}’ | sort –u | wc –l5. ps –ef | awk ‘{print $1}’ |sort –u | wc –l6. find / ex 7. ps –ef | awk ‘{print $9, $1}’8. Shell language syntax: $#9. Shell language command: for name in *10. Shell language command:

NUMBER=$(($NUMBER - 1))

11. Shell variable: PATH

Page 36: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Upcoming DeadlinesUpcoming Deadlines• Lab Assignment 1-1, Obtain a Proctor for Exams,

due May 12, 2013.• Lab Assignment 1-2, Install VMware and Knoppix

Virtual Machine, due May 5, 2013• Lab Assignment 1-3, Introduction to Linux, due

January 5, 2013• Lab Assignment 2-1, Simple Shell Scripting, due

May 19, 2012013• Lab Assignment 3-1, Advanced Scripting, due May

26, 2013.• Read Chapters 1 and 2 in your text book, Essential

System Administration.• Read Module One listed under the course Web site

Page 37: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Lab assistance, questions, and chat timeLab assistance, questions, and chat time• Questions?

• Comments?

• Concerns?

• After each Franklin Live session, I will remain on the session to provide assistance unless otherwise indicated.

Page 38: Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming

Have a good weekHave a good week