Linux common command highlights Daquan

  
 

1. vim deletes all contents of the file

ggdGvim parameters:

Method of moving the cursor h or left arrow (←) The cursor moves one character j to the left or down Arrow (↓) The cursor moves down one character k or up arrow (↑) The cursor moves up one character l or right arrow (→) The cursor moves one character to the right if you put the right hand On the keyboard, you will find that hjkl is lined up, so you can use these four buttons to move the cursor. If you want to move multiple times, for example, move 30 lines down, you can use the combination button of "30j" or "30↓", that is, after adding the number (number) you want to perform, press the action Just! [Ctrl] + [f] Screen “Down” moves one page, which is equivalent to [Page Down] button (common) [Ctrl] + [b] Screen “Up” moves one page, which is equivalent to [Page Up] button (commonly used )[Ctrl] + [d] Screen "Down" moves half a page [Ctrl] + [u] Screen "Up" moves half page + Cursor moves to the next column of non-blank characters - Cursor moves to non-blank characters The last column n, the n, means "number", for example 20 . Press the number and then press the blank button. The cursor will move the n characters of the line to the right. For example, 20 cursors will move 20 characters back to the back. 0 or function key [Home] This is the number 『 0 』: Move to the top character of this line (common) $ or function key [End] Move to the last character of this line (common) H cursor movement The first character of the line to the top of the screen M cursor moves to the first character of the line in the center of the screen. The cursor moves to the first character G of the bottom line of the screen. The last line of this file (usually) nG n is a number. Move to the nth line of this file. For example, 20G will move to the 20th line of this file (with :set nu) gg and move to the first line of this file, which is equivalent to 1G! (common) n n is a number. The cursor moves down n lines (common) to search for and replace /word to find a string named word under the cursor. For example, to search for the string vbird in the file, type /vbird! (common)? word Looks for a string with the word name word above the cursor. n This n is an English button. Represents "repeating the action of the previous search." For example, if we just executed /vbird to search down the string vbird, press n and it will continue to search for the next string named vbird. If you execute ?vbird, press n to continue searching for the string named vbird! N This N is an English button. Contrary to n, the previous search action is performed for "reverse". For example, after /vbird, pressing N means "up" to search for vbird. Using /word with n and N is very helpful! It allows you to repeatedly find some of the keywords you searched for! :n1,n2s/word1/word2/g n1 and n2 are numbers. Look for the word1 string between the n1 and n2 lines and replace the word with word2! For example, search for vbird between 100 and 200 lines and replace it with VBIRD: ":100,200s/vbird/VBIRD/g". (common): 1, $s/word1/word2/g Look for the word1 string from the first line to the last line, and replace the word with word2! (common): 1, $s/word1/word2/gc Look for the word1 string from the first line to the last line, and replace the word with word2! And the prompt character is displayed before the replacement to confirm (confirm) whether it needs to be replaced! (usually) delete, copy and paste x, X in a line of words, x is to delete one character backward (equivalent to [del] button), X is to delete one character forward (equivalent to [backspace] Is the reverse button) (common) nx n is a number, and n characters are deleted backwards continuously. For example, I want to delete 10 characters in a row, 『10x』. Dd deletes the entire column (usually) ndd n where the cursor is. Delete the n column of the cursor, for example, 20dd deletes 20 columns (commonly used) d1G deletes all the data of the cursor to the first row dG deletes all the data of the cursor to the last row d$ deletes the cursor, to the row The last character d0 is the number 0, delete the cursor where it is, to the first character of the line yy copy the line where the cursor is located (usually) nyy n is a number. Copy the next n columns of the cursor, for example 20yy is to copy 20 columns (common) y1G copy all the data of the cursor to the first column yG copy all the data of the cursor to the last column y0 copy the character of the cursor All the data at the beginning of the line y$ copies the character of the cursor to all the data at the end of the line p, P p is to paste the copied data on the next line of the cursor, P is attached to the line on the cursor ! For example, I am currently on the 20th line of the cursor and have copied 10 lines of data. Then press p, the 10 lines of data will be posted after the original 20 lines, that is, the line will start to be posted. But what if you press P? Then the original 20th line will be pushed to become 30 lines. (Commonly used) J combines the data in the column of the cursor with the data in the next column into the same column c. Delete multiple data repeatedly, for example, delete 10 rows downwards, [ 10cj ]u restores the previous action. (Common) [Ctrl]+r Redo the last action. (usually) This u and [Ctrl]+r are very common instructions! One is to restore, the other is to redo once~ Use these two function buttons, your editor, hehe! Very happy! . do not doubt! This is the decimal point! It means to repeat the meaning of the previous action. If you want to delete, repeat, etc., press the decimal point "." just fine! (Common)

Second, modify the root password When centos has not set the root password, you can access root1 in two ways, without setting the root password

[sourcecode]$ sudo su[/sourcecode ]

2, set the root login password

[sourcecode][user@v-as-rest001 ~]$ sudo passwd root[sudo] password for user:Changing password for user root.New Password:Retype new password: [/sourcecode]

This way you can use the root connection ssh directly

three, scp command

1, copy files from the machine to the destination

[sourcecode]scp -r jdk/tomcat/[email protected]:/root/workspace/[/sourcecode]

2, copy remote files to the local machine

[code]scp [email protected]:/root/workspace/jdk/jdk1.7.0_51.datatang.tar.gz ./[/code]

Note: (1)-r: transfer Directory and files in the directory, if only the file can be added -r

(2) Transfer multiple directories can be separated by spaces

(3)root is the destination user name, 192.168. 1.22: Destination ip, /root/workspace/: Transfer the folder to this folder on the destination side

Copyright © Windows knowledge All Rights Reserved