Vi editor du linux
Cours : Vi editor du linux. Recherche parmi 300 000+ dissertationsPar micktyson • 8 Août 2017 • Cours • 1 395 Mots (6 Pages) • 779 Vues
VI Exercise 1
The vi Editor is started from the command line. Whenever you invoke vi Editor, you are opening a file. You can specify the name of the file you want to create or edit when you start vi Editor or you can open a new file to be named later. It is common to start vi Editor and specify a file name. If the file exists, it is opened for editing. If the file does not exist, it is created.
1. Open a new file called myvifile using the command: vi myvifile.
2. Press the lower case letter “i” to begin inserting text at the first line.
3. Is there any indication on the screen that you are in text insertion mode? _______________________
4. Type your name. If you make a mistake do not try to correct it at this time.
5. Press the Esc key to leave Insert Entry mode and return to Command mode.
6. Is there any indication on the screen that you are back in Command mode? _____________________
7. Type a colon to go from Command mode to Last-line mode.
8. Are you now at the bottom left corner of the screen at a colon (:) prompt?
9. Type a lower case “w” (write - to save your new file), followed by a lower case “q” to quit
10. Type ls - can you see the file you created myvifile. YES or NO
11. Type cat myvifile
12. Open myvifile, vi myvifile.
13. Position the cursor at the end of your name and press the lower case letter a to append to the line you typed earlier.
14. Type some text, and the press Enter for a hard return and then type some more text.
15. Enter about three lines of text this way.
16. Press the Esc key to leave Insert mode and return to Command mode.
17. Type a colon : to go from Command mode to Last-line mode.
18. You should now be at the bottom left corner of the screen at a colon (:) prompt?
19. A the colon (:) prompt type set nu – to turn on line numbering
20. Press the Esc key to leave lastline mode and return to Command mode.
21. Type i to enter Insert mode, practise positioning your cursor (with the arrow keys) for additional editing?
22. Press Esc to enter Command mode, and continue to practise positioning your cursor (with the arrow keys).
23. You can move your cursor with the arrow keys whilst in these two modes.
24. Press the up arrow to position the cursor until it is on line two.
25. Use the “j” (jump down) command to move down 3 lines then the “k” (kick up) to move back to line two.
26. Type a lower case “o” to open a new line below the line your cursor is on and enter some new text.
...