agenda administrative issues link of the week review week two information this weeks expected...

51

Upload: johnathan-watkins

Post on 19-Jan-2018

214 views

Category:

Documents


0 download

DESCRIPTION

Administrative Announcements The midterm and the final exam are both electronic. Please verify that your testing facility can administer this type of test. The Student Learning Center has been requested to send midterm exams to your proctors. They will me within a couple days that the request has been completed.

TRANSCRIPT

Page 1: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming
Page 2: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

AgendaAdministrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming Deadlines Hands-on Information Lab Assistance, Questions, and Answers

Page 3: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

Administrative AnnouncementsThe midterm and the final exam are both electronic. Please verify that your testing facility can administer this type of test.

The Student Learning Center has been requested to send midterm exams to your proctors. They will email me within a couple days that the request has been completed.

Page 4: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

Link of the weekData Disaster

Ontrack Data Recoveryhttp://www.ontrackdatarecovery.org

Data recovery Knoll Ontrack is one of the worlds largest data

recovery services. They have performed more than 500K data recoveries since 1985.

Page 5: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

Link of the weekData Disaster Rescuers• CompuRecovery found on the Internet for desktop

hard drive recovery.• Datarecovery.com 7/24 found on the Internet.

Provides RAID, hard drive, and laptop data recovery solutions.

Norman Ken Ouchi at IBM was awarded the patent in 1978 for the recovery of data stored in failed memory unit. Later developed into RAID 10.

Page 6: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

Link of the weekData Disaster1. Big and small company operations2. Backup services off site location and media. Test

data occasionally3. Trouble shooting

Page 7: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

Link of the weekIronkey USB Flash Drivehttps://www.ironkey.com/demo-enterprise

Data Disaster Helpful Hints- Use dedicated circuits for your connection- Keep your computer cool and in a dry place- Use a UPS (Uninterrupted Power Supply)- Don’t assume that your data is permanently destroyed even if the situation looks bad- Secure your work area and devices

Page 8: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

Course expected outcome Learning Outcomes (Week five)Write Perl scripts, including variables, control flow,

and regular expression syntax

Page 9: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemProcess and multitasking

The UNIX kernel can keep track of many processes at one time, and dividing it’s time to other system tasks. Each process submitted to the kernel is assigned a unique process ID (PID). In every version of UNIX, the PID range is 0 through 32000 and is restrained to 5 digits.

Page 10: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemSingle-tasking operating systems only perform

one task at a time. The user of a single-tasking system can switch from one window to another window, executing a different application, but only one task is ever active at a time. When a user switches from one window to another window, the switched task that is left, is suspended, until the user switches back to it. Suspended tasks are not allocated system resources, but remain as it was when it was suspended. When a suspended tasks resumes execution, it starts where it left off, as if nothing ever occurred.

Page 11: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemKilling processes

At times a process must be terminated prior to its normal intended completion. The UNIX shell provides a utility named, kill to end the execution of a process. Prior to issuing the kill command to terminate a process, the processes PID must be determined by using the ps –f command. The kill command is also used to send a preparatory signal(s) to an executing process prior to receiving a termination signal. A process can only be terminated by the owner of the process or by root. The syntax format for the kill command is as follows:

kill [-options] process-ID

Page 12: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemParent and child processes

Each UNIX process has two unique numbers associated with them. One is the Process ID (PID) and the second one is the Parent Process ID (PPID). All user processes in the system has a PPID, except for the init process, which will be addressed in the course boot-up procedure.

Page 13: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemOrphan and zombie processes

Normally, when a child process is terminated, the parent process receives a SIGCHLD (code 17) signal from the kernel. After the parent receives the SIGCHLD signal, the parent can perform any last minute task or restart a new child process prior to the termination of its child. However, if the parent is terminated prior to its child process, the child process is left without a parent. If this situation occurs, the child process becomes an orphan and the init process becomes its new parent process. The orphan process will then be assigned a PPID of 1.The term used to best describe the init processes action is re-parenting.

Page 14: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemWhen a process is terminated, but still

displays its presence on the system in a Z state. This is a zombie, or defunct process on the system. A zombie is a process that completed execution, but is dead. It does not consume system resources. It retains an entry in the process table. A good process display command is ps –aux.

Page 15: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemDaemon process

A daemon process is often a system related background process. Normally, a daemon process comes into being during boot-up and terminates when the system is rebooted or shutdown.

A daemon process is not attached to a terminal like a foreground process. Verification of this attribute can be observed by performing the ps –ef command, and observing the tty field, all daemon processes display a ? in this field.

Page 16: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemDaemon processes execute in the

background and few know that they exist. Daemons execute waiting for data to be passed to them from some application, such as, a database, network, or printer daemon waiting for a print command. Daemon processes normal are known as service providers.

Page 17: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemTop command

The top command is a useful tool for displaying processes sorted by various criteria.

It is an interactive tool that updates frequently and displays data about physical and virtual devices, CPU usage, and load averages.

Page 18: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemFinger commandThe finger command displays information about users on a specific host. Local host

fingerObtain specific information on a user on a local machine:

finger dandrearView all the logged in users on a remote machine:

finger @microsoft.comGet information about a specific user on a remote machine

finger [email protected] 

Page 19: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemUmask Calculationumask setting = 027Complement of umask = 750File default permission setting = 666Directory default permission setting = 777The resultant permissions are calculated via bitwise AND of the unary complement of the argument (using bitwise NOT) and the permissions specified by the program.

Page 20: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemRegular ExpressionsDefinition: Regular expression provides a concise and

flexible means for "matching" (specifying and recognizing) strings of text, such as particular characters, words, or patterns of characters. Abbreviations for "regular expression" include "regex" and "regexp". The concept of regular expressions was first popularized by utilities provided by Unix distributions, in particular the editor “ed” and the command/filter grep.

Example: if ( /UNIX V5/ ) {print “UNIX V5 found on system. \n”;}

Page 21: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemRegular Expressions

Substitution operator: s/original value/new value/Character class: Matches a single character that is contained within the brackets [ a-zA-Z0-9_ ] Special or meta characters are used to denote actions or delimit groups:

+ means “one or more of whatever was before the + symbol”

. Matches any single character (i.e., x.z) ^ Matches the starting position within the

string $ Matches the ending position of the string or

the position just before a string-ending newline

Page 22: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemRegular Expressions

^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$

Page 23: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating System

Page 24: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating System

What is ELF?Executable and Linking Format (ELF) is a

common standard file format for executables, object code, shared libraries, and core dumps.

Page 25: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemPerl Syntax

; End of statement delimiter, Comma for line continuation

\n New line (non-printable character)<> The "diamond operator", <> is

used when a program is expecting input, but isn't concerned how it

arrives.

Page 26: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemPerl Syntax

$ Singular variables prefix (single value, number or string)

@ Prefix for plural variable (array)% Prefix for plural variable (hash)$_ Default variable It Is the "it" variable. It's often the default parm that built-in functions use, or return into.$0 Contains the name of the program

being run

Page 27: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemPerl Syntax

while ( … ){

Action statements}

What is a continuous loop?while ( 2 ) {

Action statements}

Page 28: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemPerl SyntaxThe Perl language does not support case or switch statements.

The closest way to achieve case evaluations is as follows:if ( $condition_one ) {

        action_one ();    }    elsif ( $condition_two ) {        action_two ();    }    ...    elsif {        action_n ();    }

Page 29: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemThree Types of for loopsmy @array;# Old style C for loopsfor (my $i = 0; $i < 10; $i++) {

        $array[$i] = $i;    }

# Iterating loops    for my $i (@array) {        print "$i\n";    }

Page 30: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemThree Types of for loops (continued)# Postfix for loops

    print "$_\n" for @array;

Page 31: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemPerl Syntaxforeach $total (12,9,3,7){# Sum each value in the list. $sum += $total;}

Page 32: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemPerl Syntaxforeach (-32,10,1,2,0,-1) { # Valid numbers are considered to be greater than zero# The default variable is utilized, if ( $_ > 0 ) {# Print each valid number on a single output line. print "$_\n"; }}

Page 33: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating System

Page 34: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemOpen StatementThe open function can be used to create file handles for

different purposes (input, output, and piping), you need to be able to specify which behavior you want.

When you open a data file in Perl, all you have to do is specify (a) a file handle and (b) the name of the file you want to read from.

open (CHECKBOOK, "checkbook.txt");

Page 35: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemOpen functions

open(file_handler, “file_name”)open(file_handler, “<file_name”)open (file_handler, “>file_name”)open (file_handler, “>>file_name”)

See page 21 in your Perl text.

Page 36: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemFilehandle is utilized for both input and output files.

Most file names are cryptic and are meaningless to programmers. The purpose of a filehandle is to help the programmer remember a simple file name throughout a program.

A filehandle is a name given for a file, device, socket, or pipe.

Filehandle command line format:open(filehandle, file name, permissions, chmod);

Example: open($FH,$file_name);

Page 37: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemIf you want to read text from a file line-by-line, then

use the following syntax: my @lines = <FILE>;

The <FILE> operator - where FILE is a previously opened filehandle - returns all the unread lines of the text file in list context or a single line in scalar context. Hence, if you had a particularly large file and you wanted to conserve memory you could process it line by line:

while (<FILE>) { print $_;

}

Page 38: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemWhat is List Processing?

@math_array = (6 - 4, 4 * 4, 8 / 2, 9 - 8);while ( … ) {

…}

Page 39: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemWhat is List Processing?@math_array = (6 - 4, 4 * 4, 8 / 2, 9 - 8);while ( … ) {

…}

Perl's for loop, or for statement, is used to loop through a designated block of code until a specific condition is met.

Page 40: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemWhat is a “for” loop?

for (counter = 0; counter < 10; counter++) {

…}

Three expressions are contained in a for loop: 1. Set initial state of the loop variable 2. Condition test the loop variable 3. Modify the state of the loop variable

Page 41: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating Systemforeach Statement Format

foreach VAR (List){

…}

Page 42: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating Systemforeach Statement Format@myNames = ('Larry', 'Curly', 'Moe');foreach (@myNames)

{print $_;

}

Page 43: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemPerl Program Statement

#!/usr/bin/perl #!/usr/bin/perl –w

Page 44: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemPrint continuation statementprint "error: incorrect number of arguments", "\n", "usage: intlist a b (where a < b)", "\n";

Page 45: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemPoints of interestOnline Documentation

Websites that have Perl documentation. The two biggest ones are:

http://perldoc.perl.org/http://search.cpan.org/ for modules

Page 46: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemDemonstratePerl script:

./array_display.pl

./array_sort.pl

./diamond_oper.pl <file name>

./diamond_oper.pl

./perl_it.pl and perl_loop.pl

./read_list.pl

./sum_list.pl

./linenum.pl and ./intlist.pl

Page 47: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

UNIX Operating SystemMoving Around in UNIX

cal –y (display a calendar for the year)cal –j 2010 (display Julian dates)cal –m 2010 (display Monday first day)cal –s 2010 (display Sunday first day)cal 9 2010 (display September 2010 month

Page 48: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

Break-out problemsDefine a Perl hash tableDefine ELFDefine a Perl arrayWhat convenience does a Perl filehandle provide?What is the functionality of a regular expression? Are continuous loops useful?Define an object fileDefine common-arrowPerl default variablePerl “it” variable Explain the s/pattern/new version/ command

Page 49: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

Hands-On-InformationLab Assignment 4-1, Simple Perl Scripting, due

February 3, 2014.Lab Assignment 5-1, Makefile Exercise, due

February 17, 2014.Lab Assignment 6-1, Programming Assignment 1,

due February 24.Read Chapters 3 and 4 in Essential System

Administration text.Read Module Three listed under the course Web site.Everyone should have received a Perl Quick

Reference document and script logic for Lab Assignment 5-1 and 6-1.

Page 50: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

After class assistanceQuestions?Comments?Concerns?

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

Page 51: Agenda Administrative Issues Link of the Week Review Week Two Information This Weeks Expected Outcomes Moving around in UNIX Break-Out Problems Upcoming

Lab Assistance available by phone and/or email