3, the use of the Editor VI (VI and VIM contact)
What is an editor? The editor is a software, its main function is to edit. such as writing a file, writing code.
Common editors in Windows, such as their own notepad. More useful Notepad++,ultraeditor,slickeditor
Linux common editor, comes with the oldest VI. More useful vim,gedit.
Note: The relationship between VI and Vim: VIM is an upgraded version of VI, it is recommended to use VIM.
When we refer to VI in the back, we all refer to vim.
3.1, VI Basic use
* Use VI to open/create a file, vi pathname
Two modes of *VI:
Command mode: When VI is opened by default to command mode, to enter the input mode, you need to press A or I key. In command mode, everything entered on the keyboard is treated as a command by VI.
In command mode, it is best not to enter it randomly. The corresponding command should be entered at this time, to let VI do the corresponding thing.
Input mode: The input mode is used to enter content into the file. You can press a or I into input mode from the command mode. After entering the input mode, you are free to press the keyboard to enter it. If you want to save after the input is complete, go back to command mode (because saving is also a command). Press the ESC key in input mode to return to command mode.
Note: Look at the lower left corner of the screen, when the command mode is silent message or prompt for the file name, etc. in the input mode, prompt--INSERT--
How to save in command mode:
: Wq Save and exit
: W only save does not eject
: Q Do not save exit come in and look at it without changing out
: q! does not save forced exits
: wq! Save and Force exit
Basic knowledge:
1. Ls-l Display Details:
-rw-r--r--
Drwxr-xr-x
A total of 10 characters, the first character representing the file type, and the next 9 characters representing the file permissions.
File type: the
-Represents a normal file. Ordinary files refer to text files and binary
files, such as A.C 1.txt a.out are common Files
D is the folder, and D is the directory abbreviation
L represents a symbolic connection file, which will then print out the file it points to
s represents the socket file
P indicates pipeline file pipe
Linux basic knowledge and Skills 2