Week Three Agenda Administrative Issues Link of the week Review week two lab assignment This...

32
Week Three Agenda • Administrative Issues • Link of the week • Review week two lab assignment • This week’s expected outcomes • Next lab assignment • Upcoming deadlines • Lab assistance, questions, and answers

Transcript of Week Three Agenda Administrative Issues Link of the week Review week two lab assignment This...

Week Three Agenda

• Administrative Issues• Link of the week• Review week two lab assignment• This week’s expected outcomes• Next lab assignment• Upcoming deadlines• Lab assistance, questions, and answers

Administrative Issues

• Lab assignments such as LDAP, Reiser File System, and open source papers shall follow APA documentation style.

APA Style

http://www.apastyle.org/learn/

APA Style Writing Workshop

http://www.franklin.edu/student-services/student-learning-center/academic-support/workshops.html• Grading will focus on capitalization, punctuation, and

citation.

Administrative Issues

This will be the last request for Proctor Information. Many students have already created and submitted their Proctor Information. The information will be used for both the mid-term and final exam, unless the student submits another Proctor Information request.

Link of the week

http://www.knoppix.net

This is a Knoppix Web site, receive a free and Open Source Live Linux CD. Knoppix is a GNU/Linux distribution that boots and runs completely from CD. It includes Linux software and desktop environments, with programs like OpenOffice.org, The Gimp, Apache, PHP, MySQL and many more open software programs.

Link of the week• http://en.wikipedia.org/wiki/Year_2038_problem

Known as the “Unix Millennium bug” – When you use the date command in Unix, it computes the date as the number of seconds from January 1, 1970.

Unix stores that information as a “signed 32-bit integer”. Well, that’s a really big number that will “flip over” and become negative on Tuesday, January 19 2038. At around 3am that morning, some Unix systems will think it is December 13 1901 at around 8:45pm

Review Week Two Information

What is the next user interface going to be?

The textual (command line) and the visual (graphical user) interfaces are the two most common modalities used to support engineers in network and system administration positions. The command line interface is recognized as the first generation and the graphical user interface is considered the second generation. Currently, research is trying to determine the next best interface. The command line interface is known as, “under the hood” method of interacting with the operating system.

Review Week Two Information

CLI Benefits:

Manipulate textual dataQuick customization of data allows engineers the ability to change data to another formExcellent for filtering data on systemsCommands are rich, expressive, flexible, and powerful

GUI Benefits:

Reduces data overloadSimple filtering and manipulation of the dataExcellent for displaying trends in data

Review Week Two InformationUsers can connect the standard output of one command into the standard input of another command by using the pipeline operator (|).

Demonstrateps -efps –ef | wc –lps –ef | awk ‘{print $2}’ps –ef | grep varneygls –l | cut –c1-3

who | sort > /tmp/test_file.txt

The output of the who command is piped to thesort function and written in ascending order in the/tmp/test_file.txt file. The “who” and “sort” commands execute in parallel.

Review Week Two Information

Commands

who –b (time of last system boot)who –d (print dead processes)who –r (print current run level)

List directory entries using the ls –l | less command

drwxrwxrwx permissions (directory)-rwxrwxrwx permissions (file)lrwxrwxrwx permissions (Symbolic link)-rwxrwxrwx 2 dandrear (Hardlink)

brw-rw---- permissions (block) crw------- Permissions (characterr)

Review week three lab assignment

A file descriptor is generally an index for an entry in a kernel-resident data structure that contains information on all open files. Each process on the system has its own file descriptor table. A user application passes the abstract key to the kernel through a system call, and the kernel accesses the file for the application.

A data structure is a specific way of storing and organizing data in a computer so that it can be accessed with high efficiently. Data structures can be used as a single place for storing unrelated information.

Review Week Two InformationDefinition data structureA data structure is a particular way of storing and

organizing data in a computer so that it can be used efficiently.

Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks.

Some common data structures:

array, hash table, linked list, queue, and stack

Review week three lab assignment

Keyboard

DisplayScreen

Program

#0 stdin

#1 stdout

#2 stderr

File Descriptor

Review week three 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 < ~varneyg/test.file

Append the standard output of a command to a file.

cat file1 >> file2

“Bit Bucket” – echo “stuff” >/dev/null

Review Week Two Information

The grep command searches the named input file(s) forlines containing a given pattern. Each line found is reported to standard output.Demonstrate:

grep UNIX file_3grep ‘^UNIX’ file_3grep ‘UNIX$’ file_3grep pattern file_1grep pattern *

The find command lists all pathnames that are in each of the given directories.Demonstrate:

find / -type d –printfind ~varneyg–type d -printfind . –printfind / -name file_3

Review Week 2 assignment

Logic Scripts:http://cs.franklin.edu/~varneyg/itec400/LogicScripts

Lab 2-1: printnum_logic.sh & maxlines_log2.sh

Lab 3-1: srchfile_logic.sh & srsh_logic.sh

NOTE: “…” are areas you need to modify (not tied to # of characters (Xs are indicative of the # of characters needed – currently only in maxlines_logic2.sh)

Review week three lab assignment

The Advanced Scripting lab assignment requires two shell scripts to be written.

srch.sh srchfile.sh

DemonstrateExecution of srch.sh and srchfile.sh

Case #1: ./srch.sh <pattern> <file name / directory name>

The srch.sh script will call the srchfile.sh script to perform a specific task. That specific task is task to search a file for a pattern and report it to standard output. When the end of file is reached, control is then returned to the main script, srch.sh.

Review week three lab assignment

Shell syntax srchfile.sh $1 $2original=$PWDcd $originalcd $2listing=`ls –1` (-1 is a number)for file_name in listingdo

Action Statementsdone

Review week three lab assignmentls –l | morels -a (does not hide entries)

man (utilizes the less command for reading online documentation).

cat > test_file (keyboard input goes into test_file)cat < test_file (test_file is displayed on terminal)

(< not necessary – can just use cat test_file)cat foobar_2 >> foobar_1 (append first file to second file)who | sort > test_file.txt The output of the who command is piped to thesort function and written in ascending order in thetest_file.txt file.

Review week three lab assignment

Demonstrate/export/home/varneyg/.profile umask 077

Specifies the default permissions for a file and directory

Demonstrate

The command line arguments are:

$0 $1 $2 $3 …

./arg_list.sh FIRST_ARG SECOND_ARG

Review week three lab assignmentHOME = is set to the full path name of your login directory

(/export/home/varneyg)PATH = contains the command search path. It is set to a

series of path names separated by colons (:).SHELL = This entry may be set by the system administrator

to the path name of a shell interpreter other than the standard bash.

TERM = specifies what terminal you are using.TMOUT = variable contains the integer attribute. If you set

the value greater than zero, ksh terminates if you do not enter a command within the prescribed number of seconds after ksh issues the PS1 prompt.

MAIL = Name of your Mail filesPWD = Current or Present Working Directory

Review Week Two InformationTypes of File and Directory Access:

Access File Meaning Directory Meaning

r View file contents Search directory contents

w Alter file contents Alter directory contents

x Run executable file Make your current directory

-rwx------ Owner 700

----rwx--- Group 070

-------rwx Other 007

Review Week Two Information

Shell and Programs Access:

To run a shell script, you will need read (r) and execute (x) access.

To run a binary executable program, you will need execute (x) access.

Review week three lab assignment> test_filecat /etc/passwdgrep x /etc/passwd | cut –d’:’ –f1chmod 705 *chmod 705 test_filegrep lines ~varneyg/testlines

find ~varneyg –type d -print$0

Week’s 2 & 3 expected outcomes

Upon successful completion of this module, the student will be able to:

• Create scripts using shell/Perl variables and program control flow.

• Use redirection and pipes to combine scripts and executables.

• Use man page system and find script tools.

• Discuss Perl Language

Next lab assignment

Introduction to PerlPerl - Practical Extraction and Report Language • Perl is a simple language

- Compiles and executes like a shell script or a batch file- Perl doesn’t impose special growth limitations on arrays and data strings- Perl is a composite of C, AWK, and Basic- Originally developed to manipulate text and automating tasks

Next lab assignmentPerl’s range of flexibility

- System administration- Web development- Network programming- GUI development

Major features- Procedural Programming

Sequence or unstructured statementsIncludes routines, subroutines,

methods, or functions- Object Oriented Programming

Module uses “objects” and their interactions to design applications and

computer programs.

Next Perl Lab Assignment

• Major features (continued)

- Powerful built-in support for text

processing

- Large collection of third-party

modules. http://www.cpan.org- Can even download and run on Windows:

http://www.perl.com

Next lab assignment

Read the text, Programming Perl

Chapter One (1)

Chapter Two (2)

Chapter 32: Standard Modules

Chapter 33: Diagnostic Output Messages

Next Perl Lab AssignmentOnline Reading Sections

• Chapter One: (under Overview – Natural and Artificial Languages)

Variable Syntax

Singularities

Pluralities

Arrays, Hashes, Complexities

• Chapter Two: (Under The Gory Details – Bits and Pieces)

Variables, Names, Name Lookups, Scalar Values

Numeric Literals

Pick Your Own Quotes or Leave The Quotes Out Entirely

Interpolating Array Values

Next Perl Lab AssignmentOnline Reading Sections

• Chapter Three: (under “The Gory Details – Unary & Binary Operators)

Multiplicative Operators, Additive Operators

Shift Operators

Named Unary and File Test Operators

Relational Operators, Equality Operators

Bitwise Operators

Upcoming Deadlines• Obtain Proctor (1-1) due on Jan. 30.• Lab Assignment 2-1 due on Jan. 22.• Lab Assignment 3-1 due on Jan. 29.• Lab Assignment 4-1 due on Feb. 5.• Read Chapters 1 and 2 in Programming Perl text.

Review Chapter 32: Standard Modules

Review Chapter 33: Diagnostic Output Messages

• Read Module Two listed under the course Web site.

Lab assistance, questions and answers

Questions

Comments

Concerns

After class I will help students with their scripts.