COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site...

124
COMP 104: Intro to Unix Week 1

Transcript of COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site...

Page 1: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

COMP 104: Intro to Unix

Week 1

Page 2: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Agenda

Welcome to Comp 104! Roster and Introductions Class Web Site

https://online.franklin.edu/CourseLogin?section=comp104-23ff

Personal Web Site https://cs.franklin.edu/~morrisok/comp104/

Page 3: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Agenda – Activity 1

Introduction to UNIX What is an operating system? Brief history of the Unix Operating

System The design philosophy of Unix

Page 4: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Agenda - Activity 2

How to use the UNIX system Korn shell Command Line interface Demonstration of login procedure

How to use PuTTY to log into the class Unix server einstein.

Changing your global password on email.franklin.edu

(login, passwd, changepasswd, exit) Practice login procedure (Individual) Practice changing password (Individual) The shell and environment variables

(echo, set, export, setenv) Break (10 minutes)

Page 5: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Agenda – Activity 3

UNIX Online Manual What is it? How can it help?

(man, whatis) Demonstration of Online Manual

UNIX Commands Working with files:

(ls, cat, more, wc, lp) Demonstration of working with files

commands. Break (10 minutes)

Page 6: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Agenda - Activity 3 Continued

More UNIX Commands Getting System Information:

(date, finger, whoami, whereis, who, hostname, uname)

Demonstration of system information commands.

In Class Assignment #2 Other Interesting Commands:

(echo, exit, set, setenv, alias, talk) Demonstration of other interesting commands. In Class Assignment #3

Preview of next week In class assignment

Page 7: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Professor Information

D Kris Morrison Work Number : 435-1303 Home Number: 833-4725 Email: [email protected]

I can not check email during the day. I will check email every evening and multiple times on the weekends.

Page 8: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Course Assignments

The subject line for your assignments and papers must be:

Comp104LastNameAssignmentNumber

For example: Comp104Morrison1-1

Page 9: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Course Assignments

If you email a question, please put the word “Question” in the subject line.

Page 10: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Activity 1

Page 11: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Operating Systems

What is an Operating System? A master control program It controls the execution of application

programs Acts as a primary interface between

user and hardware

Page 12: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Operating Systems

What functions does an operating system do?

Controls memory usage Maintains file storage system Schedules work Provides accounting Provides security

Page 13: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Operating Systems

Three types of Operating Systems Single-user, single-process

DOS Single-user, multiple-process

OS/2, Windows NT, Windows XP Multi-user, multi-process

Unix, Linux, VM, MVS

Page 14: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Operating Systems

What objectives should we consider when designing an Operating System?

Convenience Functionality Efficiency Ability to evolve

Page 15: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

History of Unix

Unix was developed in 1969 by Ken Thompson of Bell Labs (now AT&T).

http://www.bell-labs.com/history/unix/

http://www.levenez.com/unix/

Page 16: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

From Multics to Unix

Multics (Multiplexed Information and Computing Service) was a collaboration between Bell Labs, GE, and MIT. It was a time-sharing operating system that supported multiple users. (~ 1965 - 1969)

Ken Thompson, who worked on Multics, created his own operating system. It was a single-user operating system, so he called it Unics (Uniplexed Information and Computing Service)

Unics eventually became Unix

Page 17: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Design Philosophy of Unix

Unix has three important characteristics:

It is Multi-Tasking It is Multi-User It is Portable

Unix is also considered to be an ‘Open’ system. It can be customized to meet your needs.

Page 18: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Design Philosophy of Unix

Designed by smart people for smart people

Does not suffer fools gladly

Page 19: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Many ‘Flavors’ of Unix

There are many versions of Unix, including: AIX (IBM) HP-UX (Hewlett Packard) Solaris (Sun Microsystems) Ultrix (Digital Equipment Corporation) Unixware (Novell) Linux (Linus Torvalds) NetBSD FreeBSD

At Franklin, we will use Sun Solaris for Unix training.

Page 20: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Connection

There are several types of computers in a Unix network:

Host Computers This is the main computer that performs the work

Page 21: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Connection

Terminal Computers These are the computers that you use to

connect to the Host. They consist of a monitor and a keyboard.

There are two types of terminals: Graphical User Interface (GUI/X-Windows) Character User Interface (CUI)

Page 22: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Connection

Terminal

HostTerminal

Terminal

Page 23: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Our Technical Environment

Terminal

Terminal

Server

Terminal

Terminal

einstein

Page 24: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Activity 2

Page 25: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Shell

Unix runs a “Shell” that allows you to execute commands. You can think of this as a Command Processor (program).

The most commonly used shells are: Bourne Korn C

Page 26: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Korn Shell

This shell was created by David Korn, a scientist at Bell Labs.

The name of the Korn shell program is ksh.

Page 27: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Korn Shell Concepts

Shell Variables

* The shell uses Variables to maintain and pass information between programs

Examples: TERM, PATH, SHELL, PRINTER, PAGER, PS1

To display the value of a variable: echo $TERM

Extra: Users can define their own variablesMYVAR=“Unix is cool”print $MYVAR

Page 28: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Korn Shell Concepts

The Initialization file (.profile)

• The commands in this file are executed each time you login. Located in your home directory.

• Shell variables PATH, TERM, PS1, and PRINTER are initialized in your local .profile

• Umask and some aliases are also set in your local .profile

• Use “vi” editor to change, or customize your .profile

Page 29: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Korn Shell Concepts

The PATH shell variable

* The variable tells the shell where to look for programs.

Example:

PATH=.:/export/home/morris07/bin:/usr/local/bin:/bin:/usr/bin

Page 30: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Command Line Interface

You will work from a Command Line to type in commands. The entire line you type in is the Command Line. Separate multiple commands using semicolons.

/export/home/morris07/>________________

You type in commands and then type <enter>

General format of command: command-name options parameters

NOTE: Unix is CaSe sEnSiTiVe!!

Page 31: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The History File

The Shell saves all commands entered in a list called the HISTORY FILE. This history file is located in your home

directory. (.sh_history) Each command gets an ID# starting at 1. To display the history list use the history

command. To re-use a command in the history file, you

can use the r command: r, r 24, r da, r w Built-in-editors let you recall, edit, and re-

execute commands from the history file or the current command you are currently typing. Use “vi” commands to edit commands. <Esc>, <Enter>

Page 32: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Logging Into Unix

PuTTY is freeware that provides secure access from a PC

Required for secure access into the class Unix server einstein from our classroom.

Required for secure access from a remote location, such as your home or your office

Download PuTTY and view directions at the CLAS Lab Reference Manual web page: http://www.franklin.edu/programs/comp/resources/claslab/index_html/view

Page 33: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Logging Into Unix

Locate the PuTTY icon on your desktop and double click to open.

Page 34: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Logging Into Unixeinstein.franklin.edu

cs.franklin.edu

192.70.252.8

Select SSH

Highlight

cs and

Select

Load

Select

Open

Page 35: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Logging Into Unix

Page 36: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Login Demonstration

Page 37: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Practice Logging Into UNIX

Page 38: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Unix Commands: login

Use login to log on to the system

login:

Actually, this is the UNIX program that is run so you can login to the einstein UNIX server.

Page 39: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Unix Commands: passwd

The standard Unix command passwd or changepasswd is not available to change your einstein password at Franklin University. Use web page: https://email.franklin.edu/ to change your password globally.

For other Unix systems, use passwd to change your login password and password attributes.

Page 40: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Changing your password

Page 41: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Changing your password

Page 42: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Practice Changing Your Password

Page 43: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Unix Command Syntax

The format of all Unix commands is Command {Options..} (Parameters..}

Commands can have only options. Commands can have only parametes. Commands can have both. Commands can have neither.

Page 44: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Unix Command Syntax

Options Follow directly after the command Indicated by a minus sign (-) Multiple options can be specified in

any order Control how the command executes

Page 45: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Unix Command Syntax

Parameters Parameters pass information to the

command. The most common parameter is file

name. Tell the command what to operate on.

Page 46: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Shell: exit

Use exit to end the execution of the current shell. Will log out from Unix.

/export/home/morris07/> exit

Note: You can also use logout to log out from Unix

Page 47: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Shell: <cntl> C

To halt the execution of a command, use ^c (read ‘control c’).

Note: Whenever you see ‘^’ in Unix, it means ‘hold the <ctrl> key’.

Page 48: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Shell: print (echo)

Use print to echo arguments to the command line/export/home/morris07/> print “hello”

Use the $ symbol for Environment Variables/export/home/morris07/> print $TERM/export/home/morris07/> print $SHELL

Page 49: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Shell: echo (print)

The “echo” command works exactly the same way as “print”.

Dr. Korn intended “print” to be used.

“Print” is implemented the same way on all Unix systems. “Echo” may have some differences.

Page 50: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Demonstration of echo

Page 51: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Shell: set

Use set to display and set Shell Variables and Options on your system

/export/home/morris07/> set (Displays Variables)

To set Variables:/export/home/morris07/> export {VARIABLE}={VALUE}

/export/home/morris07/> set –o(Displays Options)

Page 52: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Shell: setenv

Use setenv to display Shell Variables (only if you use the C Shell)

/export/home/morris07/> setenv

NOTE: Since we are not using the C Shell, this will not work for us

Page 53: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Demonstration of set

Page 54: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Question/Answer Session

Page 55: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Break (10 Minutes)

Page 56: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Activity 3

Page 57: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Online Manual

The ONLINE MANUAL is a collection of files that contain documentation about Unix commands or topics.

This is accessible through the man command

Page 58: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Unix Commands: man

Use man to find and display reference manual pages

/export/home/morris07/> man command/export/home/morris07/> man –k {keyword}

/export/home/morris07/> apropos {keyword}

Page 59: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Demonstration of man

Page 60: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Demonstration of man -k

Page 61: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Unix Commands: whatis

Use whatis to display a one-line summary about a keyword

/export/home/morris07/> whatis {keyword}

NOTE: This is the same as the man –f command

Page 62: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Demonstration of whatis

Page 63: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Working With Files: ls

Use ls to list the contents of a directory

/export/home/morris07/> ls (list in column format)/export/home/morris07/> ls –a (lists all entries*)

* This will also list System or ‘Hidden’ files ( ‘.’ files)/export/home/morris07/> ls –l (long listing)

/export/home/morris07/> ls –la (long and all files)

/export/home/morris07/> ls –F Mark directories with a trailing slash (/), and executables with a trailing (*).

Page 64: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Demonstration of ls

Page 65: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Demonstration of ls

Page 66: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Working With Files: cat

Use cat to display and concatenate files (third week)

/export/home/morris07/> cat {filename}

/export/home/morris07/> cat {file1} {file2} > {file3}

Page 67: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Demonstration of cat

Page 68: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Working With Files: head,tail

The commands head and tail also display files.

head {-count} {filename} tail {-count} {filename}

Page 69: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Working With Files: head,tail

Page 70: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Working With Files: more

Use more to browse a text file one page at a time

/export/home/morris07/> more {file name}

NOTES: Type <return> to go forward one space Type <space> to go forward one page Type q to end

Extra: less is another popular pager. (Found in /opt/Util)

pg is also used often as a default pager.

Page 71: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Working With Files: more

Page 72: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Working With Files: wc

Use wc to display a count of lines, words, and characters in a file

/export/home/morris07/> wc {file name}

/export/home/morris07/> wc –c (a count of characters)/export/home/morris07/> wc –l (a count of lines)/export/home/morris07/> wc –w (a count of words)

Page 73: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Working With Files: wc

Page 74: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Working With Files: lp

Use lp to submit print requests

/export/home/morris07/> lp

/export/home/morris07/> lp –d NE {file name}

Page 75: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Question/Answer Session

Page 76: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Break (10 Minutes)

Page 77: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: date

Use date to display the date and time

/export/home/morris07/> date

NOTE: If you have the root access, you can also use this to set the time and date

Page 78: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: date

Page 79: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: finger

Use finger to display information about local and remote users

/export/home/morris07/> finger

/export/home/morris07/> finger -m {username}

Create .plan file in home directoryIf you have a .project file, finger will display the first lineMake sure permissions are set to 755Students must use finger –m Some versions of finger also display info about mail.

Page 80: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: finger

Page 81: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: who

Use who to display who is logged onto the system

/export/home/morris07/> who

This lists the user name, terminal name, login time, elapsed time, and the process ID.

Page 82: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: who

Page 83: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: whoami

Use whoami to display your username

/export/home/morris07/> whoami

/export/home/morris07/> who am i

Page 84: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: whoami

Page 85: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: whereis

Use whereis to locate the binary, source,and manual page files for a command

/export/home/morris07/> whereis {command}

Page 86: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: whereis

Page 87: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: hostname

Use hostname to display or set the name of the current host system

/export/home/morris07/> hostname

Note: Must be super-user to be able to set the host name. I.e system administrator.

Page 88: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: hostname

Page 89: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: uname

Use uname to print the name of the current system

/export/home/morris07/> uname(Current Operating System Name)

/export/home/morris07/> uname –r(Prints Operating System Release Level)

/export/home/morris07/> uname –a(Prints basic information)

Page 90: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Getting System Info: uname

Page 91: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Question/Answer Session

Page 92: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Shell: alias, unalias

Use alias to create a pseudonym or shorthand for a command or series of commands. Use unalias to remove the alias.

/export/home/morris07/> alias {name}={command}

/export/home/morris07/> alias

/export/home/morris07/> unalias {name}

Page 93: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Shell: alias, unalias

Page 94: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The Unix Shell: alias, unalias

Page 95: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Using the talk command

Use talk like instant messenger Both parties are presented with talk windows mesg [y] [n] command controls whether or

not others can send messages to your terminal screen. mesg with no argument causes current permissions to be displayed.

Talk has been disabled Extra: Use the write user command to

communicate with another logged-in user. write morris07

Page 96: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Question/Answer Session

Page 97: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Wrap Up: What We Covered

Brief history of the Unix Operating System

The design philosophy of Unix Use of the Korn shell and the

Command Line interface The shell and environment

variables

Page 98: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Wrap Up: What We Covered

How to use PuTTY to log into the class Unix server einstein.

Changing your global password on email.franklin.edu.

Used the following Unix commands:alias, cat, date, echo, exit, finger, hostname, login, lp, ls, man, more, passwd, set, setenv, uname, wc, whatis, whereis, who, whoami

Page 99: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Question/Answer Session

Page 100: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Assignments for Next Week

1-2 page Paper www.turnitin.com Class ID = 1115883 Class password Comp104S5

Worksheet from website Due next Tuesday If you send it to me, I’ll send you back

the answers.

Page 101: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Help for turnitin.com

A help sheet is available at

http://cs.franklin.edu/~varnerp/TurnItInHowTo.doc.

Page 102: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

APA Guidelines

Information is available at: http://www.franklin.edu/students/library/citeanddoc.html

Page 103: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

APA Guidelines

"APA style" is a set of specific citation formatting conventions sanctioned by the American Psychological Association.

Page 104: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

APA Guidelines

Do not have sources in your reference or works cited page unless they are cited in the text of your paper.

Always provide a citation for anyone else's work you paraphrased or quoted.

Always provide a page number for any quotations you use.

Page 105: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

APA Examples

Go to webpage.

Page 106: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Preview Of Next Week

Unix file system structure File types and access permissions Create and use directories and files Edit files with vi Use the following Unix commands:

cd, chmod, cp, id, mkdir, mv, pwd, rm, rmdir, touch, umask, vi

Page 107: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Question/Answer Session

Page 108: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Transferring files to einstein from your PC

WinSCP2 is software that provides secure FTP (File Transfer Protocol), which allows you to transfer files to and from a PC (freeware) Required for secure FTP to/from the class

Unix server einstein. Required for secure FTP from a remote

location, such as your home or your office Download WinSCP2 and view directions at the

CLAS Lab Reference Manual web page: http://www.franklin.edu/programs/comp/resources/claslab/index_html/view

Page 109: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Transferring files to einstein from your PC

Locate the WinSCP2 icon on your desktop and double click to open.

Page 110: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Transferring files to einstein from your PC

einstein.franklin.edu

cs.franklin.edu

192.70.252.8

User name for einstein

Password for einstein

Directory on einstein

Directory on your PC

Hit this button to start secure FTP session with the class Unix server einstein

Page 111: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Transferring files to einstein from your PC

Save and Load your sessionDefault

session name

Page 112: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Transferring files to einstein from your PC

Select file to copy

Hit copy button or F5

Select working filesystem

Page 113: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Unix File Editors

vi (pronounced “vee-eye”) is a visual editor that was created by Bill Joy.

vi is a “right-handed” editor

Other Unix editors: pico, emacs

Page 114: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The vi Editor

Use vi to edit files

> vi {file}

NOTE: If the file does not already exist, vi will create it for you.

Page 115: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The vi Editor: Modes

vi has two different modes:

Command ModeIn Command Mode, the characters you type are interpreted as commands.

Input ModeIn Input Mode, everything you type is inserted into the editing buffer.

Page 116: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The vi Editor: Modes

vi starts in Command Mode by default

Type <Esc> to change from Input Mode to Command Mode

Hint: If you forget which mode you are in, hit the <Esc> key twice to get to Command Mode.

Hint: :set showmode will display the input mode in the lower right hand corner of the screen.

Page 117: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The vi Editor: Inserting Data

From Command Mode:

i changes to Input Mode: insert before current position

a changes to Input Mode: insert after current position

I changes to Input Mode: insert at start of current line

Page 118: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The vi Editor: Inserting Data

From Command Mode:

A changes to Input Mode: insert at end of current line

o changes to Input Mode: open below current line

O changes to Input Mode: open above current line

Page 119: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The vi Editor: Saving and Exiting

In Command Mode (colon commands)::w writes data to the file (saves changes):wq writes data to the file and quits:w filename writes buffer to the named file:q quits:q! quits without savingZZ quits and saves

Page 120: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The vi Editor: Moving the Cursor

In Command Mode:

h, move cursor one position to the left

j , move cursor one position downk , move cursor one position upl , move cursor one position to the

right

Page 121: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The vi Editor: Deleting Data

x delete character at cursorX delete character to left of cursorD delete from cursor to end of linedw delete one worddd delete the entire current line

Page 122: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

The vi Editor: Replacing Data

r replace a single character at the cursor

ra* Replaces the current character with “a”

R replace characters by typing over

Rnew stuff* Replaces the text at cursor with “new stuff”

cw replace the word by typing over

Page 123: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Class Practice

Open Notepad or any other text editor.

Enter 4 or 5 lines of data. Save and close the file. Use WinSCP3 to send the file to your

home dirctory: /export/home/<userID>

Page 124: COMP 104: Intro to Unix Week 1. Agenda Welcome to Comp 104! Roster and Introductions Class Web Site .

Open vi and edit the file Vi <filename>

Make a few changes. Save and close the file.

ZZ in command mode

Class Practice