Editor of Linux commands

Source: Internet
Author: User
The VI is the most powerful text editor in the terminal command line, but it needs only the text editing function, and the integrated application of GCC, make and so on is not needed now, so it is not very difficult to operate, so the habit is good. The Linux distribution is usually not the VI, but the VIM,VI of the enhanced version, more powerful but more convenient operation than the traditional VI, but the start command or "VI".
On the
command line, you can start VI with the "VI xxxxxxxxx" + carriage return and open a file that already exists. If you do not have a "xxxxxxxxx" file, this file is created automatically when you save it. Enter "VI" directly, just start the text editor. The

just started VI is in command state. Under the command state, vi treats all user input as a command. The most common internal commands for

VI are:
": Q" exits the editor.
:!q ignores all changes and forcibly exits.
: I is transferred to the edit state.
: W saves the file.
: Wq to exit after saving.
: W xxxxxxxxx saves the content in the file "Xxxxxxxxx".
:!w xxxxxxxxx Saves the content in the file "Xxxxxxxxx" and replaces its original content. The
/xxx looks for the string "xxx" below.
? XXX looks for the string "xxx" above.
: nn jumps directly to NN line.
DD deletes the row where the cursor is located.

Edit State, press two or more times the "ESC" key to return to the command state, if you forget the current state, more than a few times the "ESC" key, you can. In the traditional VI, the mobile cursor also has to be in the command state, up and down respectively corresponding to "J" "K" "H" "L" key. This can also be true in vim, but it is much more comfortable to use 4 arrow keys, and can be used in any state.

Preliminary Check GCC
Gcc,gnu c Compiler, open source C-language cheap system, many software installation and rebuild the Linux kernel depends on it.   

Try to add the following 5 lines of text to a text file with VI:
#include
Main ()
{
printf ("xxx\n");


To save the file as "aaa.c."

in the terminal command line, switch to the directory where "AAA.C" is located, and execute "GCC aaa.c-o bbb" to see if there is another executable file called "BBB" in the directory. If this file exists, then "./bbb" is executed, and the command line displays "XXX". Otherwise either the file content is wrong or gcc is faulty. If GCC is all right, you can proceed to the next step.

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.