VI Editor A Quick Look
because information matters                                                                                                                                                                                                   Tutorials   |   InfolettersNews  |  Search
EMBEDDED SYSTEM,    EMBEDDED LINUX,     8051,    ARM PROCESSOR,   ECLIPSE IDE,   RTOS,   STEPPER MOTOR,   much  more...    WELCOME To The World of Knowledge 
mCard         SITE SEARCH 
Learn how to use VI editor which is very famous among Embedded Linux and Linux developers. In this article we describe most used commands of VI Editor in brief and crispy manner. Believing that this will be useful to all who want to do Embedded System development based on Linux and even useful to general Linux user.

Tags
Embedded Linux, VI Editor, Text Editor
VI editor is text editor used in Linux OS.

This is very simple and command line based text editor.

If you are interested in VI in Windows OS, then you should try Vim
Why should you learn VI Editor

>  VI Editor comes in small package.

>  To use this editor, there is no need to have a fancy desktop of Linux.

>  Linux at command line is very powerful and VI editor is used at command line.

>  In many situation we dont have desktop environment available like the case when linux crashed and you are debugging and at that time only command terminal is available, VI editor is useful


Let us use VI

Create a new file

File creation is simple, just use following commad
vi <file_name>

ec: $ vi try

Now file will be seen as following
VI Image
Let us insert text in the file. For this we need to enter into insert mode by pressing colon :
Let us press colon key and following will be the look
This is command mode. Now VI will accept commands.

Enter i key now to enter into insert mode.
[Home] [Query] [FAQ] [Aboutus] [Contact us] [Sitemap] [Privacy Policy] [Advertise ]
Logos and brand names used in this site are belonging to their respected owners. We have used them here only for the purpose of information. Enable Active X control from internet options of internet explorer to view all element of this site.
Best viewed in 1024x768 pixels
RSS FEED
now we can enter the text.
Let us save and close. For this again we need to go back to command mode. For this use escape key followed by colon :.

After that we can use command for save and close which is wq
After that we return to terminal back.

We can use list command to see if file exit.

ec: $ vi try
ec: $ ls
try

and let us use cat command to see content of file.

ec: $ cat try
This is the first.
We have created by VI editor.
ec: $


Conclude

VI works in command and insert mode. User i to enter into text mode. Use escape to back to command mode.

Below is the important command
create a new file
vi <file_name>

save and close the file
:wq

close without save
:q!

quit
:q

save as file
:w <new_file_name>

Hope this article will be useful, For more please refer manual of VI Editor. Just type following command in terminal.

ec: $ man vi
 
Top