Here is a list of exercises to improve your skill in the vi editor. Use the Arrow keys or the h,j,k,l (if your arrow keys are not supported by your terminal type) to move the cursor to the first exercise (below). Ex. 1: Inserting a character or characters can be done with the i or I keys. Position the cursor on the "M" below and type "i" and then the number "6" followed by the escape (Esc) key. Then type "I" and the number "9" followed by the "Esc" key. Make note of what happens. ABCDEFGHIJKLMNOPQRSTUVWXYZ Ex. 2: Appending a character or characters can be done with the a or A keys. Position the cursor on the "M" below and type "a" and then the number "6" followed by the escape (Esc) key. Then type "A" and the number "9" followed by the "Esc" key. Note the difference in behavior from Inserting. Make note of what happens. ABCDEFGHIJKLMNOPQRSTUVWXYZ Ex. 3: Adding lines is performed by using the o or O keys. Go to the line with "L2" at the beginning and type "o" then type "Hello" followed by the "Esc" key. Now, go back to the line containing "L2" and type the "O" key (letter o) and type "Again" followed by the "Esc" key. Make note of what happens. L1-ABCDEFGHIJKLMNOPQRSTUVWXYZ L2-ABCDEFGHIJKLMNOPQRSTUVWXYZ L3-ABCDEFGHIJKLMNOPQRSTUVWXYZ Ex. 4: Deleting characters and lines. Go to the "M" on the line containing "L1" and type the letter "x" two times. Now, go to the line containing "L2" and type the letter "d" twice. Now go to the letter "M" on the line containing "L3" and type the letter "D". Make note of what happens. L1-ABCDEFGHIJKLMNOPQRSTUVWXYZ L2-ABCDEFGHIJKLMNOPQRSTUVWXYZ L3-ABCDEFGHIJKLMNOPQRSTUVWXYZ L4-ABCDEFGHIJKLMNOPQRSTUVWXYZ L5-ABCDEFGHIJKLMNOPQRSTUVWXYZ Ex. 5: Replacing characters is done with the "r" and "R" keys. Go to the letter "M" in the line containing "L1" and type the "r" key followed by the number "5". Now, go to the letter "M" in the line containing "L2" and type the letter "R" followed by "12345" and then "Esc". L1-ABCDEFGHIJKLMNOPQRSTUVWXYZ L2-ABCDEFGHIJKLMNOPQRSTUVWXYZ Ex. 6: Search & Replace. First search for the pattern "aaaa" by typing the "/" character followed by 4 lower case a's. Now type the letter "R" and then type "ZYXW" and "Esc". To search for the next occurence of "aaaa" type "n". You can replace this next occurence by typing a ".", use this to replace all of the "aaaa" entries with the "ZYXW". L1-ABCDEFGHIJaaaaOPQRSTUVWXYZ L2-ABCDEaaaaJKLMNOPQRSTUVWXYZ L3-ABCDEFGHaaaaMNOPQRSTUVWXYZ L4-ABCDEFGHIJKLMNOPaaaaUVWXYZ L5-ABCDEFGHIaaaaNOPQRSTUVWXYZ L6-ABCDEFGHIJKLMNOPQRaaaaWXYZ L7-ABCDaaaaIJKLMNOPQRSTUVWXYZ L8-ABCDEFGHaaaaMNOPQRSTUVWXYZ L9-ABCDEFaaaaKLMNOPQRSTUVWXYZ Ex. 7: It is sure nice to undo things that you did not mean to do. Delete the line below "dd" and immediately type the letter "u". L1-ABCDEFGHIJKLMNOPQRSTUVWXYZ Ex. 8: Global search and replace. We will replace all occurences of "L" at the beginning of each line in this file. To do this type the following: :g/^L/s//Line/ The "^" above is shift + number 6. Ex. 9: Reading in the contents of another file. Type ":r /etc/motd" this will read in the contents of the Message of the day file (the file that is displayed at login). Do this at the "HERE->" below. HERE-> Ex. 10: Getting data from other programs. You can bring in output from external programs by typing (for example) "!!finger". Do this at the "HERE->" below. HERE-> Ex 11: Saving & Exiting There are 2 ways to save... Either by typing "ZZ" or by typing ":wq".