Skip to content

Click on each book below to review & buy on Amazon.

As an Amazon Associate, I earn from qualifying purchases.


RHCSA - Understand and Use Essential Tools: Create & Edit Text Files (vim)

To next objective in the exam goes into details on creating files, so more details will be present there. Instead we will focus on how we can edit text files using vim.

vim Overview

vim is a highly configurable text editor designed for efficient editing of plain text and programming languages. It operates in various modes, each serving a specific purpose:

  • Normal Mode: This is the default mode where you navigate and manipulate text. You can use commands for moving the cursor, deleting, copying, pasting, searching, and more. It's the mode you start in and return to when not actively editing.
  • Insert Mode: In this mode, you can directly insert and edit text. Pressing the I key transitions from normal mode to insert mode, allowing you to type as you would in a traditional editor. Pressing Esc returns you to normal mode.
  • Visual Mode: This mode enables text selection for performing operations like copying, cutting, and pasting. Pressing V enters visual mode, and you can then move the cursor to select the desired text. Once selected, you can apply commands to the selected text.
  • Command-Line Mode: Here, you can enter commands to perform actions beyond basic text editing. Pressing Shift+: opens the command-line at the bottom of the screen. You can execute commands like saving changes, opening files, running external programs, and applying global settings.

Learn to Edit Text Files With vimtutor

vimtutor is a command that does a great job at teaching how to work with vi & vim.

Run through the vimtutor exercises to learn how to edit text files.

Launching vimtutor:

vimtutor

The command opens a file containing lessons to practice using vim. An an example if the welcome page of that file is below. I encourage you to perform all lessons the file provides.

===============================================================================
=    W e l c o m e   t o   t h e   V I M   T u t o r    -    Version 1.7      =
===============================================================================

    Vim is a very powerful editor that has many commands, too many to
    explain in a tutor such as this.  This tutor is designed to describe
    enough of the commands that you will be able to easily use Vim as
    an all-purpose editor.

    The approximate time required to complete the tutor is 30 minutes,
    depending upon how much time is spent with experimentation.

    ATTENTION:
    The commands in the lessons will modify the text.  Make a copy of this
    file to practice on (if you started "vimtutor" this is already a copy).

    It is important to remember that this tutor is set up to teach by
    use.  That means that you need to execute the commands to learn them
    properly.  If you only read the text, you will forget the commands!

    Now, make sure that your Caps-Lock key is NOT depressed and press
    the   j   key enough times to move the cursor so that lesson 1.1
    completely fills the screen.

Support DTV Linux

Click on each book below to review & buy on Amazon. As an Amazon Associate, I earn from qualifying purchases.

NordVPN ®: Elevate your online privacy and security. Grab our Special Offer to safeguard your data on public Wi-Fi and secure your devices. I may earn a commission on purchases made through this link.