Linux vi operations

Source: Internet
Author: User
Linux vi operation highlights 1. read/write status switch a: write Esc: Read 2. save, exit save: w exit: q save exit: wq add an exclamation point indicates force save or exit: w! Q! 3. jump from the beginning to the end of the line 0: Jump to the beginning of the line Shift + $: Jump to the end of the Line 4, copy, cut/delete rows, paste a single row copy: yy more... linux vi operation highlights 1. read/write status switch a: write Esc: Read 2. save, exit save: w exit: q save exit: wq add an exclamation point indicates force save or exit: w! Q! 3. jump from the beginning to the end of the line 0: Jump to the beginning of the line Shift + $: Jump to the end of the Line 4, copy, cut/delete rows, paste a single row copy: yy multi-row copy: nyy single row cut/delete: dd multi-row cut/delete: ndd paste: p 5, search/pattern: search down pattern match string? Pattern: search up for pattern matching string n: Search N in the same direction: search in the opposite direction. pattern can contain special characters, including spaces,/, ^, $, *, and. 6. replace: s/vivian/sky/# replace the first vivian in the current row with sky: s/vivian/sky/g # Replace all vivian in the current row with sky: n, $ s/vivian/sky/# replace the first vivian from row n to row n with sky: n, $ s/vivian/sky/g # Replace all vivian values from row n to row n as sky (n is a number, if n is ., starting from the current row to the last row): % s/vivian/sky/# (equivalent to: g/vivian/s/sky /) replace the first vivian in each row with sky: % s/vivian/sky/g # (equivalent to: g/vivian/s // sky/g) replace all vivian in each row with sky 7, display line number: set nu 8, comment line: #9, jump to a line: linenum 10, jump to the beginning and end of the file to jump to the end of the file: shift + g jump to the beginning of the file: gg

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.