Homework 2
Vi Editor Cursor Movement
h j k l
h j k l
SAPACEBAR right
+, - First character of next, previous Line
forward word: w back word: b end of word: e start of line: ^,0 end of line: $ start of file: gg,:1<Enter>,1G end of file: G go to line nn: :nn<Enter>,nnG
use ESC to switch between Input and Command mode
* i: insert before the cursor * I: insert text in the beginning * a: append after the cursor * A: append to the end * o: open a line below the current line * O: open a line above the current line
To exit do one of the following:
“:wq” write and quit.
“:q” quit without save.
“:q!” quit, this is needed if you modify the text and do not want to save the file.
“ZZ” quick save.
Helpful notes on : delete, set the line number, undo change:
dd,2dd,3dd,… to delete one line, two lines or three lines.
“:set nu” is to display line numbers.
“u” is to undo changes.
“.” is to repeat the last action.
“x” deletes one single character.
To copy 10 lines, type “10yy” and put the cursor at the place where you want to have the lines and enter “p”.
_________________________________________________________________
Do the following:
1: log into your Unix User Session
2: Go to your assignment directory
3: Create new directory called Letter
4: Create text file using vi editor with the following contents:
Unix
UNIX is a computer operating system originally developed in the 1960s and 1970s by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie, and Douglas McIlroy. Today's Unix systems are split into various branches, developed over time by AT&T, as well as various commercial vendors and non-profit organizations.
The present owner of the trademark UNIX is The Open Group,