The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!

A directory structure .linux

1. The role of common subdirectories

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
We extend about
proc: prevent memory, CPU and other hardware info
tmp: temporary directory
lib and lib4: library
mnt: Multimedia

II. We began to learn command

1.cat command: show the contents of the file

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
cat command drawback: You can not use the mouse to drag the view in the character interface content and only display the contents of the end

2.more order: Full page display file contents fractional

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
more command Cons: turn the last page on the return

3.less command: command and more the same, but more extensions

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!

4. Review the contents of the file, head, tail command

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
1.head: View part of the beginning of the file (the default ten lines)
2.tail: you see the part of the end of the file (the default ten lines)
The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!

5. Statistical command file contents WC

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!

6.greb command finds and displays the line containing the specified string in the file

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
1.greb The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
2.greb -vThe latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!

7. compress command gzip, bzip2 command

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
We found that these two commands after making the compressed file is gone, finished only decompression

8. Archive command command ta

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
1. Know It's commonly used commands
-c: create a tarball -x: unzip
-v: Show Details -f: execution
-p: Keep Source entitled -t: View archive content
-C: extract the target path -z: gzip format
-j: bzip2 format
2. we experiment a bit
The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
-j: bzip2 format, too, after this we will find the path specified file content which is equivalent to the same copy.

III. Vi text editor, command

1. The role of the text editor

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!

2. The three operating modes

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
Extended about: O: Insert the cursor on a line
o: Insert the cursor in the next row
a: after the cursor in the content
i: before the cursor Inserts
us to understand what this picture: I entered vim file name on the Shell, enter the command mode, which is input through the input mode ai, o, O, I press ESC back to the command mode, press: Go to the last line mode, press ESC to retreat to the command mode.

3. The basic operation command mode

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!

Copy, paste, delete

We want to practice more, each command will try to
expand it: dw: Delete the word under the cursor
ddp: the cut line on the next line
shift + r: Replace the word cursor
The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!

File contents to find, edit, and save and exit revocation

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
I checked that servicesThe latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!

Save the file and exit the VI editor, open a new file or read other file content

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
1. I will create two files The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
2. Then I first file from the command mode to the command mode of the second fileThe latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!

The basic operation of the line mode

The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
1. The first line of this became the
The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
2. put all this became the
The latest version of linux command Centos7 (2) file and the vi text editor (the most detailed history! easiest! overpaid necessary !!!
That's all ours, we hope to engage in active practice.

Guess you like

Origin blog.51cto.com/14449524/2429254