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.
Save the file and quit
Quit without saving the file
Insert starting left of the cursor
Append starting right of the cursor
Exit insert/append mode
Search string text (case sensitive)
Search next occurrence of the searched item
Delete character under the cursor
Delete line under the cursor
Undo last change
Beginning of the file
Go to line n
End of the file
Beginning of the line
End of the line
See special characters in the file
Copy the line into the buffer
Copy 5 lines into the buffer
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.
Why I created the Vi cheat sheet?
Several years ago, when I started working in 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 the GUI text editor 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 command line editing tool Vi.
Since, at that time, I was new at Vi editor, I found myself baffling with it. The first time, I could not even come out of the file because I did not know how to close Vi editor. No shame in accepting that I had to Google it.
So, I decided to make a list of all the basic commands that I used frequently 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 cheat sheets
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 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 future, that too offline.
Do you like it?
So far, I have refrained myself from going into too much on 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.