Linux basic operations-vi operation details

Source: Internet
Author: User
Linux basic operations ----- vi operation details 1vi editor cursor movement and page flip operations 1 cursor movement h move left cursor l move right cursor j move cursor k move cursor down 2 page flip operations linux basic operations-vi operation details
1 vi editor move the cursor and flip operations 1 move the cursor h move the cursor to the left l move the cursor to the right j move the cursor k move the cursor down 2 flip operations Ctrl + f flip the whole page forward Ctrl + B flip the entire page backward Ctrl + u flip the half page forward Ctrl + d flip the half page backward 2 fast jump in the row ^ Move the cursor quickly to the first character of the line $ move the cursor quickly to the last character of the line w the cursor quickly jumps to the first letter B of the last word where the current cursor is located. the cursor quickly jumps to the first letter e of the previous word where the current cursor is located. the last letter of the word 3 file quickly jumps between the experts: set n u shows the row number in the editor: set n on u cancel some operations in the editor to show the row number 1G/gg quickly jump to the first line G quickly jump to the end line of the file xG quickly jump to the object line x 4 input mode I insert status at the current cursor a insert status after the current cursor A move the cursor to the end of the current row, And enter the insert mode o insert a new row under the current row, move the cursor to the beginning of the new row, enter the insert state O insert a new row above the current row, move the cursor to the beginning of the new row, enter the insert status cw delete the characters from the current cursor to the end of the word, and enter the insert status c $ delete the characters from the current cursor to the end of the line, and enter the insert status c ^ delete the character from the current cursor to the beginning of the line, and enter the insert status 5 delete operation x delete the single character dd where the cursor is located delete the row dw where the cursor is located delete the current character to the end of the word (including spaces) all characters in de delete the current character to the end of the word (excluding spaces at the end of the word) all characters d $ delete all characters from the current character to the end of the line d ^ delete all characters from the current character to the end of the line J delete the line break at the end of the line where the cursor is located, it is equivalent to merging the content of the current row and the next row. 6. undo the Operation u. cancel the last operation and restore the operation result, you can use multiple u commands to restore the multi-step operations that have been performed U cancel all the operations on the current row Ctrl + r restore the operations that have been revoked using the u command 7 Copy and Paste operation yy copy the content of the entire row of the current row to the vi buffer yw copy the content of the current cursor to the end of the word to the vi buffer y $ copy the content from the current cursor to the end of the line to the vi buffer y ^ copy the content from the current cursor to the beginning of the line to the vi buffer p to read the content of the vi buffer, and paste it to the current position of the cursor. 8 string search function/word search string word from top to bottom in the file? Word search string from bottom to top in the file word n locate next matched search string N locate previous matched search string 9 string replacement function: s/str1/str2/replace the first str1 string found in the current row with str2: s/str1/str2/g replace all str1 strings found in the current row with str2: x, ys/str1/str2/g replace all str1 strings from x to y with str2: % s/str1/str2/g replace str1 strings from the entire file with str2: s/str1/str2/c find the first str1 string in the current row and replace it with str2, then ask (use less)
Related Article

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.