270 likes | 389 Views
Week 2 Lab Agenda. Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi. Command Line FTP. Open connection Set transfer mode Transfer single / multiple file(s) Execute command in remote server Execute command in local machine
E N D
Week 2 Lab Agenda • Command Line FTP • Commands Review • More UNIX commands to learn • File name expansion - * • Introduction of vi May 16, 2005
Command Line FTP Open connection Set transfer mode Transfer single / multiple file(s) Execute command in remote server Execute command in local machine Close FTP connection May 16, 2005
Open the FTP Connection $ftp ftp > open matrix.senecac.on.ca OR: $ftp matrix.senecac.on.ca May 16, 2005 source: Ling Zhu
Set the Transfer Mode Set to ASCII mode: ftp > asc Set to binary mode: ftp > bin May 16, 2005 source: Ling Zhu
Commands to transfer file(s) Transfer a single file: ftp > get ftp > put Transfer multiple files–Use file name expansion ftp > mget *.html ftp > mput lecture?? source: Ling Zhu May 16, 2005
Execute Commands on Remote Server ftp > cd dirctoryName ftp > pwd ftp > ls source: Ling Zhu May 16, 2005
Execute Commands on Local Machine Windows machine UNIX/Linux machine ftp >lcd dirctoryName ftp >!cd ftp >!dir ftp >!cd dirctoryName ftp >!pwd ftp >!ls source: Ling Zhu May 16, 2005
Close the FTP Connection ftp > close OR: ftp > bye May 16, 2005 source: Ling Zhu
Commands we have learned • cd $HOME • cd ~ • cd • cd – May 16, 2005 source: Ling Zhu
Commands we have learned • ls • ls –l • ls –a May 16, 2005 source: Ling Zhu
Commands we have learned • touchfilename • mkdir directoryname May 16, 2005 source: Ling Zhu
Commands we have learned • passwd • pwd May 16, 2005 source: Ling Zhu
So far we know how to After Lab1, you should know how to: • log in • change your password • create a file • list the files in your working directory • create a directory • display the name of your working directory • change directories • log out May 16, 2005 source: Ling Zhu
How to know a command more man command • Press space bar or type f to go forward • Type b to go backward • Type q to exit May 16, 2005 source: Ling Zhu
More Symbols • . current working directory • . . parent directory • . ./.. grandparent directory May 16, 2005 source: Ling Zhu
More Commands to learn • cp source destination Copy file • mv source destination Rename file May 16, 2005 source: Ling Zhu
Can you answer them? • cp policydestination • What if destination is a file that doesn’t exist? • What if destination is a file that exists? • What if destination is a directory? • What if there is a policy file under destination? • mv policydestination • Can you answer the last four questions? May 16, 2005 source: Ling Zhu
More Commands to learn To view a file • cat filename • head filename - display top 10 lines head - n3file1- display top 3 lines head -3file1- display top 3 lines • tail filename - display last 10 lines tail –2file1 - display last 2 lines • more filename - can only scroll down • less filename - can scroll up and down May 16, 2005 source: Ling Zhu
More Commands to learn • rm filename Delete file - eg: rm file1 - delete file named file1 • rm –r dirctoryname Delete directory - eg: rm – r dir1 - delete directory named dir1 • rmdir directoryname Delete empty directory - eg: rmdir dir2 - delete empty directory dir2 May 16, 2005 source: Ling Zhu
Introduction of vi Three modes of vi • command mode • insert mode • last line mode May 16, 2005 source: Ling Zhu
Introduction of vi – command mode Cursor movement • h • j • k • l Delete text • x • dd Undo edit • u – move to left – move to next line – move to last line – move to right – delete one character – delete one line – undo your last edit May 16, 2005 source: Ling Zhu
Introduction of vi – command mode • – move back 4 characters • – move down 5 lines • – move up 3 lines • – delete two character from the cursor • – delete three lines 4h 5j 3k 2x 3dd May 16, 2005 source: Ling Zhu
Introduction of vi – insert mode Insert text • i • I • a • A • o • O – insert text at left of the cursor – insert text at the beginning of the cursor line – insert text at right of the cursor – insert text at the end of the cursor line – open a new line under the cursor line – open a new above the cursor line May 16, 2005 source: Ling Zhu
Introduction of vi – last line mode Start with : and end with hitting Enter • – display line number • – hide line number • – save and exit vi • – save without exit vi • – exit vi when no change • – exit vi without saving any change : set nu : set nonu : wq : w : q : q! May 16, 2005 source: Ling Zhu
Introduction of vi – Switch mode ESC – Escape from insert mode May 16, 2005 source: Ling Zhu
Warning Unix/Linux commands are case sensitive!! If you issue LS rather than ls, you will lose mark!! May 16, 2005