[Free Download] Vi Cheat Sheet For Beginners

New to the classic Vi editor? Knowing the basics will help you a great deal. Here's a cheat sheet to help you learn the basic Vi commands.
Warp Terminal

I have often shared my Linux experience with you. Today I am going to share my Vi cheat sheet that has often saved me time in googling for a quick command.

Basic Vi commands

This is not a detailed tutorial to teach you each and every aspect of Vi editor. In fact, itโ€™s not a tutorial at all. Itโ€™s just a collection of basic Vi commands and their brief description for a quick reference.

Command Description
:x Save the file and quit
:q! Quit without saving the file
i Insert starting left of the cursor
a Append starting right of the cursor
ESC Exit insert/append mode
arrows Move cursor
/text Search string text (case sensitive)
n Search next occurrence of the searched item
x Delete character under the cursor
dd Delete line under the cursor
u Undo last change
:0 Beginning of the file
:n Go to line n
G End of the file
^ Beginning of the line
$ End of the line
:set list See special characters in the file
yy Copy the line into the buffer
5yy Copy 5 lines into the buffer
p Paste buffer after the current line

You can download the above cheat sheet in a PDF format from the link below:

You can print it and keep it at your desk or just save it for offline use. And if you are interested, take this quiz and test the Vi knowledge you just learned.

Why did I create the Vi cheat sheet?

Several years ago, when I started working in the Linux terminal, the idea of using a command line editor horrified me. I had used desktop Linux before but it was my personal computer so I happily used GUI text editors like Gedit. But in the working environment, I was stuck with the command line and there was no scope of using a graphical editor.

I was forced to use Vi for basic edits in the files on remote Linux boxes and this is where I identified and started to admire the power of the command line editing tool Vi.

Since, at that time, I was new at Vi editor, I found myself baffled with it. The first time, I could not even come out of the file because I did not know how to close the Vi editor. No shame in accepting that I had to Google it.

So, I decided to list all the basic commands I frequently used for editing in Vi. This list or cheat sheet, as you may call it, helped me a lot in my early days with Vi. With time, I grew up with Vi and now I donโ€™t even need to look at the Vi cheat sheet because I have the commands memorized by heart.

Why should you use Vi cheat sheet?

I can understand your situation if you are just getting started with Vi. Your favorite Ctrl+S doesnโ€™t work for saving files. Ctrl+C and Ctrl+V were supposed to be the universal shortcut for copy and paste but it wonโ€™t work in Vi universe.

Thousands of people use such cheat sheets for various programming languages and/or tools that give them a quick reference to commonly used steps/commands. Trust me, using cheat sheets is among the best practices advised to programmers.

This Vi cheat sheet will help you a lot if you are just starting with Vi or if you infrequently use the Vi editor (so you keep forgetting the commands). You can save it and use it for quick reference in the future, that too offline.

Do you like it?

So far, I have refrained from going into too much on the terminal side. How do you find this post? Do you want me to share more such cheat sheets and downloadable items? Your suggestions are welcomed.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries ๐Ÿ•ต๏ธโ€โ™‚๏ธ

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! Youโ€™ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.