16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Introduction to <strong>Unix</strong><br />

vi file-name start visual editor<br />

File is created/opened and first screen displayed.<br />

command<br />

i, a, o, etc<br />

key<br />

insert<br />

From command mode (to line mode)<br />

":" waits for input on last line of screen<br />

"/" search forward for a pattern<br />

"?" search backward for a pattern<br />

! Cursor motion<br />

left h or <br />

down j<br />

up k<br />

right 1 or <br />

start of previous line -<br />

start of next line + or <br />

start of current line 0<br />

start of text on line ^<br />

end of current line $<br />

Top<br />

H, Middle M, Bottom L of screen<br />

scroll up ^U, down ^D<br />

page back ^B, forward ^F<br />

word back b, forward w, end of word e<br />

word back B, forward W, end of word E<br />

goto last line<br />

position in a column 70 70|<br />

! Multiple moves<br />

5w five words forward<br />

5+ five lines forward<br />

G, 1st line lG, 6th line 6G<br />

! Searching<br />

for a string:<br />

forward /, back ?<br />

next same direction n<br />

next reverse direction N<br />

single character "c" on current line:<br />

forward fc, backward Fc<br />

next same direction ;<br />

next reverse direction ,<br />

just before a character:<br />

forward tc, backward Tc<br />

! Insert<br />

until an key<br />

8<br />

insert before cursor i, append after a<br />

before start of line I, at end of line A<br />

open line before current O, after o<br />

iHello inserts <strong>the</strong> word ‘Hello’<br />

70a- appends 70 dashes<br />

! Delete<br />

char at cursor x, before cursor X<br />

word dw, line dd, end of line D<br />

d5w deletes 5 words<br />

! Change<br />

word cw, line cc, rest of line C<br />

change to end of word ce<br />

change to before next comma ct<br />

! Replace<br />

just one character r<br />

overwrite mode till escape<br />

! Substitute<br />

replaces chars, changes to insert mode<br />

1 char s, next 5 chars 5s, a line S<br />

! Put back <strong>the</strong> last thing deleted<br />

after cursor p, before P<br />

swap 2 chars xp, swap 2 lines ddp<br />

! Yank<br />

3 words y3w, line Y, 5 lines 5Y<br />

copy a line Yp, make 3 copies Yppp<br />

! Mark point (labels a-z)<br />

Mark a point <strong>with</strong> label a<br />

Return to marked point a<br />

Delete to marked point a<br />

Yank to marked point a<br />

! Buffers (buffers "a - "z)<br />

link line into buffer a "aY<br />

delete line into buffer a "add<br />

extract from buffer a "ap<br />

R<br />

ma<br />

'a<br />

d'a<br />

y'a

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!