+ All Categories
Home > Documents > Week 3 Lab Agenda

Week 3 Lab Agenda

Date post: 28-Jan-2016
Category:
Upload: felton
View: 24 times
Download: 0 times
Share this document with a friend
Description:
Week 3 Lab Agenda. File Name Expansion Review commands More vi More commands to learn. File Name Expansion. Shell metacharacters * – Match 0 to many characters ? – Match exactly one character [abc] – Match one character in a set of characters - PowerPoint PPT Presentation
Popular Tags:
21
1 Jan 24, 2005 Jan 24, 2005 Week 3 Lab Week 3 Lab Agenda Agenda File Name Expansion File Name Expansion Review commands Review commands More vi More vi More commands to learn More commands to learn
Transcript
Page 1: Week 3 Lab Agenda

11 Jan 24, 2005Jan 24, 2005

Week 3 Lab AgendaWeek 3 Lab Agenda

File Name Expansion File Name Expansion Review commandsReview commands More viMore vi More commands to learnMore commands to learn

Page 2: Week 3 Lab Agenda

22 Jan 24, 2005Jan 24, 2005

Shell metacharactersShell metacharacters * * – Match 0 to many characters– Match 0 to many characters

? ? – Match exactly one character– Match exactly one character

[abc] [abc] – Match one character in a – Match one character in a setset of of characters characters

[!] [!] – Match all – Match all BUTBUT the characters in a set the characters in a set

[a-z] [a-z] – Match all lower case characters– Match all lower case characters

[a-zA-Z] [a-zA-Z] – Match all alphabetic characters– Match all alphabetic characters

\ \ – turn of the magic of the next character– turn of the magic of the next character

File Name ExpansionFile Name Expansion

Page 3: Week 3 Lab Agenda

33 Jan 24, 2005Jan 24, 2005

GG – move to the last line of the file – move to the last line of the file

1G1G – move to the first line of the file – move to the first line of the file

15G15G – move to the fifteenth line of the file – move to the fifteenth line of the file

m charm char – mark this location and name this line char – mark this location and name this line char

‘ ‘charchar – move to the beginning of the line named – move to the beginning of the line named charchar

'''' – return from the last movement– return from the last movement

command mode – move in a filecommand mode – move in a file

source: Ling Zhu

Two single quote

Page 4: Week 3 Lab Agenda

44 Jan 24, 2005Jan 24, 2005

/string/string – move forward to the first occurrence – move forward to the first occurrence of string in the file of string in the file

?string?string – move backward to the first occurrence – move backward to the first occurrence

of string in the fileof string in the file

nn – repeat last searching – repeat last searching

NN – repeat last searching in opposite direction – repeat last searching in opposite direction

command mode – move in a filecommand mode – move in a file

source: Ling Zhu

Page 5: Week 3 Lab Agenda

55 Jan 24, 2005Jan 24, 2005

^D^D – scroll down half screen – scroll down half screen

^U^U – scroll up half screen – scroll up half screen

^F^F – scroll forward one full screen – scroll forward one full screen

^B^B – scroll backward one full screen – scroll backward one full screen

HH – move to the top of the screen – move to the top of the screen

MM – move to the middle of the screen – move to the middle of the screen

LL – move to the top of the screen – move to the top of the screen

command mode – move in a screencommand mode – move in a screen

source: Ling Zhu

Page 6: Week 3 Lab Agenda

66 Jan 24, 2005Jan 24, 2005

00 – move to the beginning of the line – move to the beginning of the line

$$ – move to the end of the line – move to the end of the line

fmfm – move forward to the first occurrence of – move forward to the first occurrence of

m on the linem on the line

3ff3ff – move forward to the third occurrence – move forward to the third occurrence

of f on the lineof f on the line

FnFn – move backward to the first occurrence – move backward to the first occurrence

of m on the lineof m on the line

3F43F4 – move backward to the third occurrence – move backward to the third occurrence

of 4 on the lineof 4 on the line

command mode – move on a linecommand mode – move on a line

source: Ling Zhu

Page 7: Week 3 Lab Agenda

77 Jan 24, 2005Jan 24, 2005

ww – move to the beginning of the next – move to the beginning of the next wordword

ee – move to the end of the next word – move to the end of the next word

bb – Move back to the beginning to the – Move back to the beginning to the previous word previous word

WW – move to the beginning of the next – move to the beginning of the next WORDWORD

EE – move to the end of the next WORD – move to the end of the next WORD

BB – Move back to the beginning to the – Move back to the beginning to the previous WORD previous WORD

command mode – move between wordscommand mode – move between words

source: Ling Zhu

delimited by any non-alphanumeric character

delimited by any

blank space

Page 8: Week 3 Lab Agenda

88 Jan 24, 2005Jan 24, 2005

{{ – move backward to the beginning of a paragraph – move backward to the beginning of a paragraph

}} – move forward to the end of a paragraph – move forward to the end of a paragraph

(( – move backward to the beginning of a sentence – move backward to the beginning of a sentence

)) – move forward to the end of a sentence – move forward to the end of a sentence

command mode – more movementcommand mode – more movement

source: Ling Zhu

Page 9: Week 3 Lab Agenda

99 Jan 24, 2005Jan 24, 2005

What would be the result of issuing What would be the result of issuing the following sequences of vi the following sequences of vi commands?commands?

<ESC>3k3Wd$<ESC>3k3Wd$

<ESC>k3laalt<ESC>k3laalt

<ESC>2kCmkdir<ESC>kill<ESC>2kCmkdir<ESC>kill

Can you answer?Can you answer?

source: Ling Zhu

Page 10: Week 3 Lab Agenda

1010 Jan 24, 2005Jan 24, 2005

J J – join two lines– join two lines

ZZZZ – exit and save any change – exit and save any change

.. – repeat last change – repeat last change

More about vi – command modeMore about vi – command mode

source: Ling Zhu

Page 11: Week 3 Lab Agenda

1111 Jan 24, 2005Jan 24, 2005

dwdw – delete to the beginning of the next word – delete to the beginning of the next word

d$d$ – delete to the end of the line – delete to the end of the line

d)d) – delete to the beginning of the next sentence – delete to the beginning of the next sentence

dtedte – delete till the next e – delete till the next e

dddd – delete the current line – delete the current line

Latest deleted text is saved in a buffer. Latest deleted text is saved in a buffer. How to put it?How to put it? pp – put the content before the cursor or line – put the content before the cursor or line

PP – put the content after the cursor or line – put the content after the cursor or line

vi command mode – cut and pastevi command mode – cut and paste

source: Ling Zhu

Page 12: Week 3 Lab Agenda

1212 Jan 24, 2005Jan 24, 2005

y10Gy10G – copy from here to line 10 – copy from here to line 10

y$y$ – copy to the end of the line – copy to the end of the line

yLyL – copy from here to the last line of the screen – copy from here to the last line of the screen

yy''aa – copy from here till the marked line a – copy from here till the marked line a

yyyy – copy the whole line – copy the whole line

Latest copied text is saved in a buffer. Latest copied text is saved in a buffer. How to put it?How to put it? pp – put the content before the cursor or line – put the content before the cursor or line

PP – put the content after the cursor or line – put the content after the cursor or line

Advanced vi – copy and pasteAdvanced vi – copy and paste

source: Ling Zhu

Page 13: Week 3 Lab Agenda

1313 Jan 24, 2005Jan 24, 2005

“ “adwadw – delete to the beginning of the next word – delete to the beginning of the next word

and saved to the buffer named aand saved to the buffer named a

“ “bd$bd$ – delete to the end of the line and saved to – delete to the end of the line and saved to

the buffer named bthe buffer named b

“ “cyLcyL – copy from here to the last line of the – copy from here to the last line of the

screen and saved to the buffer named cscreen and saved to the buffer named c

“ “dyydyy – copy the whole line to the buffer named d – copy the whole line to the buffer named d

How to put the latest text in buffer? How to put the latest text in buffer? “ “apap – put buffer a content before the cursor or line – put buffer a content before the cursor or line

“ “bPbP – put buffer b content after the cursor or line – put buffer b content after the cursor or line

Advanced vi – named bufferAdvanced vi – named buffer

source: Ling Zhu

Page 14: Week 3 Lab Agenda

1414 Jan 24, 2005Jan 24, 2005

^G ^G – display the status of the current file– display the status of the current file

^L^L – refresh screen – refresh screen

^Z^Z – suspend this job and return to the Unix – suspend this job and return to the Unix command line and command line and fg fg come back to the come back to the suspend jobsuspend job

~~ – convert case – convert case

Advanced vi – command modeAdvanced vi – command mode

source: Ling Zhu

Page 15: Week 3 Lab Agenda

1515 Jan 24, 2005Jan 24, 2005

:e:e– edit a file– edit a file

:!:!– execute commands without exit vi– execute commands without exit vi

Advanced vi – last line modeAdvanced vi – last line mode

source: Ling Zhu

Page 16: Week 3 Lab Agenda

1616 Jan 24, 2005Jan 24, 2005

..

Symbols for Special DirectoriesSymbols for Special Directories

source: Ling Zhu

your home directoryyour home directory

current working directorycurrent working directory

.... parent directoryparent directory

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

~~ your home directoryyour home directory

$HOME$HOME

Page 17: Week 3 Lab Agenda

1717 Jan 24, 2005Jan 24, 2005

cp cp policypolicy destinationdestination

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?

Review last week commandsReview last week commands

Page 18: Week 3 Lab Agenda

1818 Jan 24, 2005Jan 24, 2005

What are the siz commands to view a What are the siz commands to view a file?file?

Why Why lessless can do more work then can do more work then moremore does?does?

Review last week commands Review last week commands

source: Ling Zhu

Page 19: Week 3 Lab Agenda

1919 Jan 24, 2005Jan 24, 2005

Which is the command to remove a file?Which is the command to remove a file?

Which is the command to rename a file?Which is the command to rename a file?

What is the difference betweenWhat is the difference between

rm -r rm -r and and rmdir rmdir ??

source: Ling Zhu

Review last week commandsReview last week commands

Page 20: Week 3 Lab Agenda

2020 Jan 24, 2005Jan 24, 2005

catcat Display the content of a file or multiple filesDisplay the content of a file or multiple files

- eg: cat file1

display the content of file1

- eg: cat file2 file3 file4

display the content of file2, file3 and file4 Combine with Combine with >> to copy a file to copy a file Combine with Combine with >> to create a new file to create a new file

use ctrl+D to finishuse ctrl+D to finish Combine with Combine with >>>> to append to a file to append to a file

source: Ling Zhu

More Details of Commands LearnedMore Details of Commands Learned

Page 21: Week 3 Lab Agenda

2121 Jan 24, 2005Jan 24, 2005

mkdir -p mkdir -p

Make pass directories as needed.Make pass directories as needed.

ls –dls –d

List directory entries instead of contentsList directory entries instead of contents

rm –irm –i

Prompt before any removalPrompt before any removal

rm –rirm –ri

When delete directory with contents,When delete directory with contents,

prompt before any removalprompt before any removal

More Details of Commands LearnedMore Details of Commands Learned

source: Ling Zhu


Recommended