What is Linux vi? - Functionkey Inc.

Functionkey

Transmiting change, become a fan

Supetech
09 November 2017
Functionkey
As the reach of the IT department becomes wider we focus on maintaining a grasp of the hard skills:...
Supetech
07 November 2017
Functionkey
Functionkey Inc. is a 501(c)3 non-profit organization focusing on core concepts needed to be competitive in the IT field. We believe that mastery of scripting virtualization and server technology are key foundations needed to master all areas of Info...
CLI Guy
07 November 2017
Networking
Subnetting allows a large network block to be logically segmented into multiple smaller networks, or subnets. The use of many smaller networks allows the use of varying physical networks, such as Ethe...

 

Functionkey Inc.

Functionkey Inc. is a 501(c)3 non-profit organization.

What is Linux vi?

code

The default editor that comes with the Linux operating system is called vi (visual editor). [Alternate editors for Linux environments include pico and emacs, a product of GNU.]

The Linux vi editor is a full screen editor and has two modes of operation:

  1. Command mode commands which cause action to be taken on the file, and
  2. Insert mode in which entered text is inserted into the file.

In the command mode, every character typed is a command that does something to the text file being edited; a character typed in the command mode may even cause the vi editor to enter the insert mode. In the insert mode, every character typed is added to the text in the file; pressing the <Esc> (Escape) key turns off the Insert mode.

While there are a number of vi commands, just a handful of these is usually sufficient for beginning vi users. To assist such users, this Web page contains a sampling of basic vi commands. The most basic and useful commands are marked with an asterisk (* or star) in the tables below. With practice, these commands should become automatic.

NOTE: Both Linux and vi are case-sensitive. Be sure not to use a capital letter in place of a lowercase letter; the results will not be what you expect.

To use vi on a file, type in vi filename. If the file named filename exists, then the first page (or screen) of the file will be displayed; if the file does not exist, then an empty file and screen are created into which you may enter text.


vi filename

edit filename starting at line 1

vi -r filename

recover filename that was being edited when system crashed

To Exit vi

Usually the new or modified file is saved when you leave vi. However, it is also possible to quit vi without saving the file.

Note: The cursor moves to bottom of screen whenever a colon (:) is typed. This type of command is completed by hitting the <Return> (or <Enter>) key.

OpenStack Networking
What Is a Linux Shell?
 

Comments

No comments made yet. Be the first to submit a comment
Already Registered? Login Here
Guest
Monday, 22 January 2018

Captcha Image