Posted on

BasicsAt a minimum you need ot be able ot open a file edit it and get out without breaking things

BasicsAt a minimum you need ot be able ot open a file, edit it, and get out without breaking things. To open a file# vi newfile.You will be ni Normal mode. You can use the arrow keys to move in any mode. To begin typing you will need to be in Insert mode; to get there you can use• • •i —insert hereo- add a line below and insert there A- insert at end of current lineTo get back to Normal mode press ESC.Getting around ni Normal mode:• u-undo• CTL-r – redo• yy-‘yank’ (copy) the current line • dd – cut current line• p-paste•^/$- beginning/end of line•/ M / L- high/mid/low on page•gg / G- top/bottom of file•*/# – match next/previous word under cursor•Repeating commands:=- (dot) repeat the last thing you didor a number before the command: 10dd cuts 01 lines, 2p pastes twice. To select, you need ot be ni Visual mode. From Normal press• v – select characters• V- select lines• CTL-v – select blocks • у-сору• d – delete• p- pasteTo exit vi, go to Normal mode then issue a vi command. Commands begin with a colon:• w: ! – w r i t e c h a n g e s o t f i l e• :w! /path/otherfile – writes to otherfile• w: > otherfile – appends buffer to otherfile • :wg! – write and quit, the most common way to leave. This is linux server fundamentals subject

Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.


Student review: (5 ratings) 5 out of 5 people found this solution helpful.