0% found this document useful (0 votes)
8 views2 pages

CentOS Lab: Using Nano and Vim Editors

This document outlines a lab exercise for the LPIC-1, Exam 1 (101-500) focusing on text editors in a CentOS 7 environment. It provides step-by-step instructions for using the nano and vim editors, including creating, editing, and saving a text file named lab9.txt. The document emphasizes the importance of prior knowledge and successful completion of earlier sections before attempting this lab.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

CentOS Lab: Using Nano and Vim Editors

This document outlines a lab exercise for the LPIC-1, Exam 1 (101-500) focusing on text editors in a CentOS 7 environment. It provides step-by-step instructions for using the nano and vim editors, including creating, editing, and saving a text file named lab9.txt. The document emphasizes the importance of prior knowledge and successful completion of earlier sections before attempting this lab.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Section 9 Lab

LPIC-1, Exam 1 (101-500)


By Christine Bresnahan
Recommended Linux Distributions for this exercise:
 CentOS version 7

Note: For a successful lab session, it is assumed you are using the recommended Linux distribution(s) and
the recommended version, and that your Linux systems are booted. In addition, it is assumed that you can log
into the system as a standard user as well as either the root account or a user with super user privileges. Also,
you should have successfully completed the prior sections’ labs and sessions & viewed this section's videos.

Follow these actions to explore concepts and commands covered in this section (but please feel free to
explore as much as you want. And don’t forget that you can get help on the usage of these commands
through the man pages. Type in man and follow it with the utility name, then press Enter to view
information on the utility):
1. Log into either your CentOS distro tty2 terminal, using the username and password you created when
you installed the system.
2. Try the nano text editor by typing nano [Link] and pressing Enter. This will put you into the nano text
editor and create a file called [Link].
3. Type in the following information into the text editor:
I need to know about the following editors for the exam:
nano,
emacs,
and vi (also called vim)
4. Save the text from the nano editor's buffer to the disk, by pressing the Ctrl+O key combination (that's a
lowercase O). At the editor screen's bottom you should see a message. Read the message and press Enter.
5. Now quit the nano text editor, by pressing the Ctrl+X key combination. You should now have a
command-line prompt (though it is most likely at the bottom of your terminal screen.)
6. View the file's contents, by typing cat [Link] and pressing Enter.
7. This step and the next few steps assumes you have a fully-functioning vim editor installed on your
system.
Type vi [Link] and press Enter to enter into the vim editor to modify the [Link] file. You are now in
the vim editor's Command mode.
8. Jump into Insert mode, by pressing the i key (lowercase I) on your keyboard. Notice at the text editor
screen's bottom the word INSERT appears.
9. Go back to Command mode, by pressing the Esc key on your keyboard. Notice at the text editor
screen's bottom that the word INSERT is no longer shown.
10. Experiment moving around in the vim editor, by only using the j, l (lowercase L), k, and h keys on your
keyboard. Note the movement to the cursor each key performs.
11. Using the only the h, k, l, or j keys, move your cursor to the end of the last line in the text.
12. Now that your cursor is on the last line of the text, press the o key (lowercase O) on your keyboard to
open a line beneath the last line and go into Insert mode.
13. Type the following beneath the last line of your text (you will not need any special keys to move around
at this point, because you are in Insert mode):
Movements and Searches in vim Command mode:
/? (search)
h,j,k,l (cursor moves)
Making Changes in vim Command mode:
i,o,a
d,p,y,dd,yy (example: d2)
Leaving the vim text editor from Command mode using EX mode:
:wq, :wq!, :q!, :x
14. After you have completed entering the text, press the Esc key to leave Insert mode and go back to
Command mode.
15. Save your text and leave the editor from Command mode by pressing and holding the Shift key, then the
z key two times.
16. View the file's contents, by typing cat [Link] and pressing Enter.
17. Go back into the vim editor to edit the [Link] file, by typing vi [Link] and pressing Enter.
18. Try out the various commands you wrote about in step #13, and make additional notes concerning their
functions in the text editor. (Warning: Before trying out the "Leaving the vim editor from Command
mode using EX mode" commands, be sure to save your text editor contents first — type :w to write out
the text editor's contents to disk using EX mode.)

You might also like