If you are not yet familiar with using the vi text editor, then follow the steps in this section to practice with it.
After rebooting the server, connect to the server again using Putty.
From the Putty window, type the following command to open a new text file named test.txt:
vi test.txt
Now that you have the text.txt file open with vi, press the i key on you keyboard to go into insert mode, so that you can start typing in text.
Type the word test several times and then press Enter.
Type the word test again several times and then press Enter.
Press the Esc key on your keyboard. This will bring you out of insert mode.
Press the colon key (:) on your keyboard, then type wq and then press Enter. By typing wq, you are telling the vi editor that you want to write (w) to the file and also quit (q) the vi editor.
Run the ll command to list the files in your current directory. You should see your test.txt file that you've just now created.
Run the following command again to re-open the test.txt file in vi:
vi test.txt
Press the i key on your keyboard to go into insert mode.
Use the left and right arrow keys to move your cursor around, within the file.
Move your cursor to the very end of the last line and then press Enter to insert a new line.
Copy the following text:
**Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.**
Right-click in the Putty window and then click Paste. This should paste in the text that you've just copied.
Press the Esc key on your keyboard to get out of insert mode.
Press the forward-slash (/) character on your keyboard. The forward-slash command tells vi that you want to search for a piece of text in the file.
Type in the word in and then press Enter to find the next occurrence of the word in. You'll see that vi highlights the first occurrence of any text that has the word "in" in it.
Press the n key on your keyboard to find the next occurrence of the string "in".
Keep pressing the n key until you've pressed it several times and pay attention to the text that it is highlighting when you do this.