Linux basics: A beginner’s guide to text editing with vim – Red Hat

Vim is a text editor I can relate to: Vim and I are 90s babies, and we prefer to work smarter, not harder. There are plenty of reasons to learn vim, from its simple navigation tools to its fast and dirty character correction. Here is a crash course in an exceptional tool that every system administrator should learn.

[ Download Now: Vim cheat sheet ]

What is Vim?

Great Linux Resources


  • Advanced Command Cheat Sheet
  • Download RHEL 9 free of charge through the Red Hat Developer program
  • A Guide to Installing Applications on
  • Linux Linux

  • System Administration Skills Assessment
  • How well do you know Linux? Take a quiz and get a badge

The name Vim is an acronym for Vi Improved. This editor is an improved version of the Vi text editor that we all know and love, and is usually seen in CLI form; however, it has a GUI version available for standard desktop use. Vim allows you to combine files using vimdiff, which is not the same as diff, the comparison utility, as well as an autocomplete feature and a comparison mode that is similar to the diff utility. The real change and usefulness of this editor is the support of plugins and multiple scripting languages such as Perl and Python. Also included is support for compression functions such as tar and zip, as well as network transfer protocols such as SSH, FTP, and HTTP.


Vim modes

The Vim editor has three modes that determine how the editor works: Normal (or Command), Insert, and GUI.

[ Looking for a different text editor? Download the Emacs cheat sheet. ]


mode Normal

mode allows you to give commands to the editor. Functions such as the following can be found here

: :w for writing/saving. :q to exit. :

  • w
  • <file name

  • .txt> to name a new file
  • .

  • :q! to exit without saving changes
  • to the file

Press the Esc key to start Normal mode and enter :(desired command) [Enter] to perform the intended task. For example, if you were working on a new file and wanted to call it

‘file.txt’, you would use the following:

:w file.txt [ENTER]

Insert mode If you’ve made it this far, you probably know what

Insert mode

does. However, for those who don’t, if you press the I (lowercase i) key once, you’ll see the message “INSERT” at the bottom of the screen, indicating that you can now edit or add text.

To exit this mode and return to normal mode, press the Esc key once.



GUI mode is only available in some environments. It offers a graphical, point-and-click interface to be used with a mouse and keyboard.


tips and

tricks Now, imagine Vim being that shady guy in the corner wearing a trench coat selling fake Rolex watches from inside his lapel, only instead of imitation watches, VIM has tricks and shortcuts on offer. Seriously, there are too many to list in this article, but I’ll list some of my favorites here:

dd removes all text from the current line (deleting the entire line) and

  • saves the deleted text to the clipboard
  • .

  • p pastes (puts) anything from the Vim clipboard to the current cursor, and pairs nicely with the previous full-line delete shortcut
  • .

  • r replaces a character and is ideal for quick correction.

Using r is a bit more complicated than the others:

  1. Press Esc to enter Normal mode
  2. .

  3. Move the cursor over the
  4. character you want to correct.

  5. Type r followed by the character you want to use.

For example, “Goodbee” can be edited to “Goodbye” by highlighting the first “e” and then entering ry


[ Get more from your text editor: 5 Vim features for advanced users. ]

Where to start

I encourage you to try these tricks. There is no better way to learn than to create a text file and then make random edits.

Actually, that may not be true, which brings me to the best way I’ve found to learn Vim. I learn best with a little direction, so it’s no surprise that a tutor is just what I needed. Vim has a built-in tutor that can be accessed by entering vimtutor in the terminal. This tutor will give you lessons on specific topics, from beginner to advanced. I highly recommend this tool for beginners.

If you are someone who enjoys having fun with technology, check out the free adventure game based on Vim Vim-Adventures. This game is a great way to learn a new skill while enjoying some sweet old school gaming eyes.

This article is just a small sample of what Vim really has to offer. Once you’re more comfortable with the things we’ve talked about here, I encourage you to look for “operators and movements” as well as point files to customize your Vim experience. If you’re looking for more information about text editors, check out our other text editor articles.

Contact US