VI is the widely used text editor in UNIX operating systems. I have had the chance to use the VI editor in the Solaris and Linux operating systems. In this article we are going to learn how to use the VI editor.
VI in Linux and Solaris is almost the same. The main difference I encountered is the arrow keys. In UNIX-based versions you have to use h, j, k and l for left, down, up and right, moving one character/line at a time. But in Linux, we can use the standard arrow keys for editing.
In the Solaris OS, if you use the standard arrow keys during editing you will see some unwanted outputs if the arrow keys are not mapped correctly. Sometimes it may display the error "Terminal too wide" if your terminal is wider than the typical 1024 x 768.
Open a new file/open for editing: To open a new file just use the vi command with a filename like the example below.
vi newfile.txt
This command will open the VI editor with a new file named newfile.txt in the current directory. If a file named newfile.txt is present in the current directory, then the above command will open that file for editing.