1may 16, 2005 week 2 lab agenda command line ftp commands review more unix commands to learn file...

26
1 May 16, 2005 May 16, 2005 Week 2 Lab Agenda Week 2 Lab Agenda Command Line FTP Command Line FTP Commands Review Commands Review More UNIX commands to learn More UNIX commands to learn File name expansion - File name expansion - * * Introduction of vi Introduction of vi

Upload: ethan-turner

Post on 13-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

11 May 16, 2005May 16, 2005

Week 2 Lab AgendaWeek 2 Lab Agenda

Command Line FTPCommand Line FTPCommands ReviewCommands ReviewMore UNIX commands to learnMore UNIX commands to learnFile name expansion - File name expansion - **Introduction of viIntroduction of vi

Page 2: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

May 16, 2005May 16, 2005 22

Command Line FTPCommand Line FTP

Open connectionOpen connection Set transfer modeSet transfer mode Transfer single / multiple file(s)Transfer single / multiple file(s) Execute command in remote serverExecute command in remote server Execute command in local machineExecute command in local machine Close FTP connectionClose FTP connection

Page 3: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

33 May 16, 2005May 16, 2005

$$ftpftp

ftp >ftp > open matrix.senecac.on.ca open matrix.senecac.on.ca

$$ftp matrix.senecac.on.caftp matrix.senecac.on.ca

Open the FTP ConnectionOpen the FTP Connection

OR:OR:

source: Ling Zhu

Page 4: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

44 May 16, 2005May 16, 2005

ftp >ftp > asc asc

ftp >ftp > bin bin

Set the Transfer ModeSet the Transfer Mode

source: Ling Zhu

Set to ASCII mode:Set to ASCII mode:

Set to binary mode:Set to binary mode:

Page 5: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

May 16, 2005May 16, 2005 55

Commands to transfer file(s)Commands to transfer file(s)

ftp >ftp > get get

ftp >ftp > put put

source: Ling Zhu

ftp >ftp > mget mget *.html *.html

ftp >ftp > mput mput lecture?? lecture??

Transfer a single file:Transfer a single file:

Transfer multiple files–Transfer multiple files–Use file name expansionUse file name expansion

Page 6: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

May 16, 2005May 16, 2005 66

Execute Commands Execute Commands on Remote Serveron Remote Server

ftp >ftp > cd dirctoryName cd dirctoryName

ftp >ftp > pwd pwd

ftp >ftp > ls ls

source: Ling Zhu

Page 7: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

May 16, 2005May 16, 2005 77

Execute Commands Execute Commands on Local Machineon Local Machine

ftp >ftp > llcd dirctoryNamecd dirctoryName

ftp >ftp > !!cdcd

ftp >ftp > !!dirdir

source: Ling Zhu

ftp >ftp > !!cd dirctoryNamecd dirctoryName

ftp >ftp > !!pwdpwd

ftp >ftp > !!lsls

Windows machine UNIX/Linux machine

Page 8: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

88 May 16, 2005May 16, 2005

ftp >ftp > close close

ftp >ftp > bye bye

Close the FTP ConnectionClose the FTP Connection

OR:OR:

source: Ling Zhu

Page 9: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

99 May 16, 2005May 16, 2005

Commands we have learnedCommands we have learned

cd $HOMEcd $HOME

cd ~

cd

cd –cd –

source: Ling Zhu

Page 10: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

1010 May 16, 2005May 16, 2005

Commands we have learnedCommands we have learned

ls

ls –lls –l

ls –als –a

source: Ling Zhu

Page 11: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

1111 May 16, 2005May 16, 2005

Commands we have learnedCommands we have learned

touchtouch filenamefilename

mkdir directoryname

source: Ling Zhu

Page 12: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

1212 May 16, 2005May 16, 2005

passwdpasswd

pwd

Commands we have learnedCommands we have learned

source: Ling Zhu

Page 13: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

1313 May 16, 2005May 16, 2005

So far we know how toSo far we know how to

After Lab1, you should know how to:After Lab1, you should know how to:log inlog inchange your password change your password create a filecreate a filelist the files in your working directorylist the files in your working directorycreate a directorycreate a directorydisplay the name of your working directory display the name of your working directory change directorieschange directorieslog outlog out

source: Ling Zhu

Page 14: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

1414 May 16, 2005May 16, 2005

How to know a command moreHow to know a command more

man man commandcommand

Press space bar or type f to go forwardPress space bar or type f to go forward

Type b to go backwardType b to go backward

Type q to exitType q to exit

source: Ling Zhu

Page 15: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

1515 May 16, 2005May 16, 2005

.. current working directorycurrent working directory

. .. . parent directoryparent directory

. ./... ./.. grandparent directorygrandparent directory

More SymbolsMore Symbols

source: Ling Zhu

Page 16: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

1616 May 16, 2005May 16, 2005

cp cp source destinationsource destination

Copy fileCopy file

mv mv source destinationsource destination

Rename fileRename file

More Commands to learnMore Commands to learn

source: Ling Zhu

Page 17: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

1717 May 16, 2005May 16, 2005

cp cp policypolicy destinationdestination

Can you answer them?Can you answer them?

source: Ling Zhu

mv mv policypolicy destinationdestination

What if What if destinationdestination is a directory? is a directory?

What if there is a policy file under What if there is a policy file under destination?destination?

What if What if destinationdestination is a file that exists? is a file that exists?

What if What if destinationdestination is a file that doesn’t exist? is a file that doesn’t exist?

Can you answer the last four questions?Can you answer the last four questions?

Page 18: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

1818 May 16, 2005May 16, 2005

To view a fileTo view a file

cat cat filenamefilename

head head filename filename - - display top 10 lines

head - nhead - n 33 file1file1- - display top 3 lines

head -3head -3 file1file1- - display top 3 lines

tail tail filenamefilename - - display last 10 lines

tail –2tail –2 file1file1 - - display last 2 lines

more more filename - filename - can only scroll down

less less filename - filename - can scroll up and down

More Commands to learnMore Commands to learn

source: Ling Zhu

Page 19: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

1919 May 16, 2005May 16, 2005

rm rm filenamefilename

Delete fileDelete file - eg: rm file1 - delete file named file1

rm –r dirctoryname

Delete directoryDelete directory

- eg: rm – r dir1 - delete directory named dir1

rmdir rmdir directorynamedirectoryname

Delete Delete emptyempty directory directory- eg: rmdir dir2 - delete empty directory dir2

More Commands to learnMore Commands to learn

source: Ling Zhu

Page 20: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

2020 May 16, 2005May 16, 2005

Three modes of viThree modes of vi command modecommand mode

insert modeinsert mode

last line modelast line mode

Introduction of viIntroduction of vi

source: Ling Zhu

Page 21: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

2121 May 16, 2005May 16, 2005

Cursor movementCursor movement hh

jj

kk

ll

Delete textDelete text xx

dddd

Undo editUndo edit uu

Introduction of vi – command modeIntroduction of vi – command mode

source: Ling Zhu

– – move to leftmove to left

– – move to next linemove to next line– – move to last linemove to last line

– – move to rightmove to right

– – delete one characterdelete one character

– – delete one linedelete one line

– – undo your last editundo your last edit

Page 22: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

2222 May 16, 2005May 16, 2005

– – move back 4 charactersmove back 4 characters

– – move down 5 linesmove down 5 lines

– – move up 3 linesmove up 3 lines

– – delete two character from the cursordelete two character from the cursor

– – delete three linesdelete three lines

Introduction of vi – command modeIntroduction of vi – command mode

source: Ling Zhu

4h4h5j5j

3dd3dd

3k3k

2x2x

Page 23: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

2323 May 16, 2005May 16, 2005

Insert textInsert text ii

II

aa

AA

oo

OO

Introduction of vi – insert modeIntroduction of vi – insert mode

source: Ling Zhu

– – insert text at left of the cursorinsert text at left of the cursor

– – open a new line under the cursor lineopen a new line under the cursor line

– – insert text at the beginning of the cursor lineinsert text at the beginning of the cursor line

– – open a new above the cursor lineopen a new above the cursor line

– – insert text at the end of the cursor lineinsert text at the end of the cursor line– – insert text at right of the cursorinsert text at right of the cursor

Page 24: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

2424 May 16, 2005May 16, 2005

Start with Start with :: and end with hitting Enter and end with hitting Enter

– – display line numberdisplay line number

– – hide line numberhide line number

– – save and exit visave and exit vi

– – save without exit visave without exit vi

– – exit vi when no changeexit vi when no change

– – exit vi without saving any changeexit vi without saving any change

Introduction of vi – last line modeIntroduction of vi – last line mode

source: Ling Zhu

: set nu: set nu

: set nonu: set nonu

: wq: wq

: w: w

: q: q

: q!: q!

Page 25: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

2525 May 16, 2005May 16, 2005

ESCESC – Escape from insert mode – Escape from insert mode

Introduction of vi – Switch modeIntroduction of vi – Switch mode

source: Ling Zhu

Page 26: 1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi

2626 May 16, 2005May 16, 2005

WarningWarning

Unix/Linux commands areUnix/Linux commands are

If you issue LS rather than ls, you If you issue LS rather than ls, you willwill

case sensitive!!case sensitive!!

lose mark!!lose mark!!