Linux Text Editor

Source: Internet
Author: User
Tags linux text editor

Text Editor

The text editor is an important tool in the Linux operating system. Among them, VI is the most widely used text editor, which can be used in any shell. In addition, Red Hat Enterprise Linux6 provides gedit tools that allow for more intuitive text editing using the GUI, while the evince tool can be used to easily view PDF documents.

VI Editor

The full name of VI is "visual Interface", both "visual interaction interface". The VI Editor enables you to edit files in any shell, character terminal, or character-based network connection without the need for the GUI to efficiently edit, delete, replace, and move files within the file. VI is a shell-based full-screen text editor with no menus and all operations are based on commands.

VI has three modes:

Command mode (General mode): After the start of VI, the default into the command mode, any mode can be the ESC key back to the command mode (can be more than a few times). Command mode can be done by typing different commands to complete the selection, copy, paste, undo and so on.

Command mode common commands:i insert text before the cursor

o Insert a new row below the current line

DD Delete entire row

yy puts the contents of the current line into the buffer

N+yy The contents of n rows into a buffer (copy n rows)

P put the text in the buffer after the cursor (paste)

u undo Last Action

R replaces the current character

/ Find key Sub

Insert mode: Press "I" key in the command mode, can enter insert mode, enter edit text content in insert mode, use ESC key to return to command mode.

Common commands for Insert mode: I insert text starting at the cursor position.

I the command is to move the cursor to the beginning of the current line and then insert the text before it.

A for appending new text after the cursor's current position

A move the cursor to the end of the line where you will start inserting new text

o Open a new line below the line where the cursor is located, and place the cursor at the beginning of the line, waiting for the input text

O Insert a row above the line where the cursor is located, and place the cursor at the beginning of the line, waiting for the input text

Edit mode: In the command mode ":" Key can enter the EX mode, the cursor will move to the bottom, where you can save modify or Exit VI.

Common commands for Edit mode:

: W Save current changes

: Q exit

: q! Force exit, do not save changes

: x save and exit, quite with: Wq

: Set number Displays line numbers

:! System command executes a system command and displays the result

: SH switch to command line, use Ctrl+d to switch back to VI

Linux Text Editor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.