VI Editor Cheat Sheet / Survival Guide ;)

Let’s face it! The VI text editor for Linux can be quite intimidating. This post shows the most commands to help even the newest of vi / vim user survive. This is not the full list of vi commands, but these will help you whilst you are getting familiar with it. Alternatively, visit for the full manual.

To open a file in vi, type:

vi theFileNameYouWantToEdit

Then use any of the following commands:

General Save & Exit Controls
:xSave & Exit
:qExit, No changes
:q!Exit, Ignore changes
– Both ‘:w’ and ‘:x’ requires you to have write permissions.
CommandInsert Text & Lines
iInsert at the cursor
IInsert before the line
aAppend text after the cursor
AAppend text after the line
o Create a new line
– Each of these commands puts the vi into insert mode.
– Press the <Esc> key to put vi back into command mode.
– The ‘i’, ‘a’ and ‘o’ command supports undo if you press the * key.
CommandDelete Text and Lines
DDelete the remainder of the line, from the cursor
ddDelete the current line
– The command ‘dd’ supports undo if you press the * key.
CommandMoving Around
GMove the end of the file
Left Arrow KeyMove left
Right Arrow KeyMove right
Up Arrow KeyMove up
Down Arrow KeyMove down
– You can also use: ‘j’ for down, ‘k’ for up, ‘h’ for left and ‘l’ for right.

What is VI / VIM Editor?

VI / VIM is the default text editor that is provided on the Linux platform. It can be quite intimidating to use, but make no mistake. VI is an extremely powerful tool!

Example of the vi / VIM editor in Linux

Don’t like VI/VIM editor?

You could always install Nano text editor and save yourself the effort of learning vi editor.

To install Nano text editor on Debian or Ubuntu machines:

sudo apt-get install nano

To install the Nano text editor on CentOS or RHEL based platforms

sudo yum install nano

You could also try other text editors! Read this article about an alternative text editor called: Micro.

In Conclusion

Using VI becomes super easy once you have the “keys to the kingdom”! ;-) I hope you liked this post. If so, please click the like button and you will receive a million years of good Luck! Feel free to read other great posts at

About Anto

Hi, my name is Anto! I am a cloud computing hobbyist! Give me anything to do with the cloud, and I am interested. I work for a Cloud computing company by day and as a Cloud computing hobbyist by night! My projects use PHP, NodeJs, Ubuntu, MySQL and of course Amazon Web Services. Hopefully, my blog aids your cloud journey! Feel free to post a comment and share your thoughts.

View all posts by Anto →

Leave a Reply

Your email address will not be published. Required fields are marked *