Common linux commands (5) common VI commands

Source: Internet
Author: User
Vi common command wq save quit q! Exit esc without saving: return to command mode insert command a Insert text after the cursor A add text at the end of the line I insert text before the cursor I insert text at the beginning of the line o insert new lines under the cursor O insert new lines on the cursor insert the new line location command... info & nbsp; | vi common command wq save and quit q! Exit esc without saving: return to command mode insert command a Insert text after the cursor A add text at the end of the line I insert text before the cursor I insert text at the beginning of the line o insert new lines under the cursor O insert new lines on the cursor insert the new line positioning command h left click to j direction down key k direction up key l direction right click $ move the end of the line 0 move the first line H move to the top of the screen M move to the middle of the screen L move to the bottom of the screen: set nu sets the row number: set nonu cancels the line number gg to the first line G to the last line: n to line n nG to line n delete command x delete the character nx where the cursor is located delete the last n characters dd delete the row where the cursor is located, ndd delete the n rows under the cursor dG delete the content from the row to the end D delete the position from the cursor to the end of the line: nl copy and cut command yy Y copy current row nyy copy to current row Next n lines p paste to cursor line below dd cut current line search and replace command r replace cursor R from cursor location start to replace characters, press Esc to end u to cancel the previous operation/string to search for the specified string : When searching, set ic is case-insensitive. n searches for the next position of a specified string. N searches for the previous position of the specified string: % s/replaced character full-text replacement: start line number, end row number s // replaced character/replaced character replace specified row hard to save ZZ quit: wq! Force save and exit only the administrator and file owner: q! Do not save exit: w save: r file name import file content :! Command to directly execute the command in vi: map definition shortcut ^ P : Unmap cancel shortcut: AB test qqdenghaigui@163.com after entering test, will become qqdengghaigui@163.com: unab cancel the above operation ~ Home directory tree main directory ~ /. Vimrc vi configuration file by qqdenghaigui

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.