04.04.2013 Views

Introduction to Unix and Networks

Introduction to Unix and Networks

Introduction to Unix and Networks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

THE ESSENTIAL Vi<br />

To enter the vi screen edi<strong>to</strong>r, go<strong>to</strong>anxter m window <strong>and</strong> type: vi<br />

NOTES: i) The CONTROL key is represented by ˆ,use like the shift key<br />

ii) The ESCAPE key is represented by {ESC}.<br />

The ESCAPE key must be released before the comm<strong>and</strong> character is pressed.<br />

iii) The BACKSPACE key is represented by {bs}.<br />

The vi text edi<strong>to</strong>r has two modes. Itcan either be in text insert or comm<strong>and</strong> mode. Note that vi puts tilde<br />

characters down the lefth<strong>and</strong> side of the test window <strong>to</strong>mar k the position of empty lines in the text buffer.<br />

When vi starts up it is in Comm<strong>and</strong> Mode, soyou need <strong>to</strong> just pressibefore entering text.<br />

If you want <strong>to</strong> append text <strong>to</strong> an existing buffer, useainstead ofibefore entering text.<br />

Te xt<br />

inser t<br />

mode<br />

esc<br />

i<br />

Comm<strong>and</strong><br />

mode<br />

Yo u stee r the cur sor abou t in Comma n d mo d e by key i ng one of sev era l spec i al cha r s:<br />

------------------------------------------------------------------------------<br />

Ba ckwar ds Forwa r ds<br />

h Char l or use arrow key s<br />

MO VE: e Word b cur sor moves on same l ine<br />

Upwar ds Dow n wa rds<br />

k Line j or use arrow key s<br />

-----------------------------------------------------------------------------<br />

Ba ckwar ds Forwa r ds<br />

x Char de l et e charac ter<br />

DE L ETE : Word dw del ete wor d<br />

Line dd de lete cur ren t line<br />

d$ de lete <strong>to</strong> end of l ine<br />

Block ma . ...d’ a ma r k start of block ,<br />

mo ve the cur sor <strong>to</strong> block end , <strong>and</strong> de lete<br />

-----------------------------------------------------------------------------<br />

In Comma n d mo d e you can enter Tex t Mo d e us i ng :<br />

Re t ur n <strong>to</strong> Comma n d Mo d e from Tex t Mo d e :<br />

i - inse r t tex t before the cur ren t cu rso r po s ition<br />

I - inse r t tex t at the beg inni ngofthe cur ren t line<br />

a - append tex t af ter the cur ren t cu rso r po s ition<br />

A - append tex t at the end of the cur ren t line<br />

o - open s anew l ine for inpu t be l ow t he cur ren t line .<br />

O - open s anew l ine for inpu t abo ve the cur ren t line .<br />

es c - ret urn <strong>to</strong> comma n d mo d e<br />

-----------------------------------------------------------------------------<br />

BLOC K MO V ING ma mar k star t of "a" block<br />

y’a takes a copy o f block f rom ’a <strong>to</strong> cur ren t<br />

-----------------------------------------------------------------------------<br />

SEARCH<br />

/wor d sear che s fo r wo r d<br />

-----------------------------------------------------------------------------<br />

YA N KBACK :<br />

Y copy l ine int o yank bac k bu f fe r<br />

yw copy cur ren t wo r d int o yank bac k bu f fe r<br />

25

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

Saved successfully!

Ooh no, something went wrong!