Linux notes--vim Editor, combination conditions, file lookup, suid special permissions

Source: Internet
Author: User
Tags exit in

  • Vim: Full screen editor, modal editor

  • Vim mode: Edit mode (Command mode) input mode last line mode

  • Mode conversion:

  • Edit-Input: I is converted to input mode before the character of the current cursor.  A is converted to input mode after the current cursor character.  o Create a new row below the current cursor line and switch to input mode.  I switch to input mode at the beginning of the line where the cursor is currently located.  A moves to the input mode at the end of the line at which the current cursor is located. O Create a new row and switch to input mode at the top of the current cursor line.

  • Input--Edit: ESC

  • Edit-Last line: (can only be converted from edit mode to last-line mode): Colon

  • Last line-edit: ESC

  • One. Open File

  • Vim + (digital) file: Open files directly to the cursor in how many lines + if no number, the default is the tail line vim +/pattern file: Open the file to the beginning of the line that was first matched to the pattern

  • Two. Close the file

  • 1. Last-line mode close file: W Save w! Force save Q Exit Wq Save and exit q! Force not save exit

  • 2. Exit in edit mode: ZZ Save exit

  • Three. Move cursor (edit mode)

  • 1. Character movement: H left L right J Upper K (#h: Move # characters)

  • 2. Move in words: W moves to the next word the first e moves to the ending of the current word B moves to the beginning of the current word (#w: move # words)

  • 3. In-line jump: 0 Absolute Beginning ^ first non-whitespace character of the beginning of a line

  • 4. Between the lines jump: G The last line of G start of the first line (last mode: line number carriage return, #G jump to line #)

  • Four. Flip Screen

  • CTRL + F down one screen Ctrl + B up one screen CTRL + D flip down half screen Ctrl + U flip up half screen

  • Five. Delete a single character

  • x Delete a single character at the cursor location #x Delete the cursor and the backward # characters

  • Six. Delete command

  • #d The jump character #dw #de #db DD Delete the current cursor row #dd Delete the line containing the lines in the current cursor in the last line mode start,endd (3,4d) Enter delete 3 rows and 4 rows. Represents the current line $ represents the last line +# represents the down # line $-1 represents the penultimate line

  • Seven. Paste command

  • P (lowercase) If you delete or copy an entire line of content, paste it below the line where the cursor is located. If the deleted or copied content is a non-full row, paste to the back of the character in the cursor P (uppercase) if the entire line of content is deleted or copied, Paste to the top of the line where the cursor is located. If the deleted or copied content is a non-full row, paste to the front of the character that contains the cursor

  • Eight. Copy commands

  • (Y usage same as D command) #yw #ye #yb yy #yy

  • Nine. Modify the command

  • (c usage same as D command) #cw #ce #cb cc #cc

  • 10. Replace

  • R can only replace single character R replacement mode

  • 11. Undo

  • U undo the previous edit operation, the continuous U command undoes the last undo of up to 50 operations (also available with #u) Ctrl + R

  • 12. Repeat the previous edit operation '. '

  • 13. Visualization Mode

  • V Select v by character Select by Rectangle block

  • 14. Find

  • /pattern? Pattern n Next N prev (regular expression supported)

  • xv. Find and replace

  • Use the S command s#pattern#string#g/i in the last row mode to specify the line lookup replace R1,R2 s#pattern#string#g/i% for full text

  • 16. How to edit multiple files using vim

  • Vim file1 file2 Display the first file last line mode by default: Next toggles the next file prev back to the previous file (you need to save the changes before you go back to the last file). Switch to the first file. QA All exits

  • 17. Split-screen display of a file

  • CTRL + W s horizontal splitter window Ctrl + W v Split window vertically CTRL + W toggle windows up/down Q exit QA all exit

  • 18. Multi-window display multiple files

  • Vim-o file1 file2 Horizontal display vim-o file1 file2 vertical Display

  • 19. Save some of the contents of the current file as a different file

  • R1,R2 w path file name in last-row mode

  • 20. Fill in the current file with another file content

  • R path File name fills the next line of the cursor line

  • 21. Interacting with the shell

  • ! Commad carriage return (exit)

  • 22. Vim Settings

  • 1. Display or suppress line numbers set Nu (display) set Nonu (not shown)

  • 2. Ignore or differentiate the character case set IC (Ignore) set Noic (not ignored)

  • 3. Set auto indent set AI set Noai

  • 4. Highlight matches to the text sed hlsearch sed nohlsearch

  • 5. Syntax highlighting syntax on syntax off

  • 23. Configuration Files

  • /ETC/VIMRC: All users are in effect

  • ~/.VIMRC: Only valid for current user

  • (Note: An error occurred when exiting vim illegally: Vim-r Open file is saved correctly and then delete the file ending with. SWP)

  • Test:

  • Integer test:-le-ge-lt-gt-eq-ne

  • Character test: = = = = > <-n-z

  • File test:-e-f-d-r-w-x

  • Combination test:-A with relationship-O or relationship! Non-relationship if: [! \ (* *-o **\)]==! * *-A! **

  • File Lookup:

  • Locate non-real-time, fuzzy search is based on the whole system to ask the home database, fast (if there is no database, you can manually generate a file database, long time updatedb)

  • Find:find Find Path Lookup criteria find a later processing action

  • Real-time search, precision, slow (traverse all files in the specified directory to complete the lookup, support many search criteria)

  • Find path: Default to current directory

  • Lookup criteria: All files that default to the specified path

  • Handling actions: Default to show print

  • Match criteria:-name "filename" matches the file name exactly (the filename is matched with: *?). [])-iname "case-insensitive"-regex pattern file name matching based on regular expression-user username based on the owner lookup-group groupname according to the genus group file name matching-uid uid: According to the UID in Row Find-gid GID: Find-nouser based on GID find a file that is not a master-nogroup find a file that is not a group-size (+/-#K #M #G default to Byte # (number)) Search by file size-type # (d f C b L p s) find-mtime-ctime-atime by file type: Based on the timestamp (+/-) of the lookup file in days (+/-) (-mmin ... In minutes ...) -perm-/mode file Permissions Lookup-file permissions can be fully included in this mode to be matched/9 bits in any one of the lines

  • Combination conditions:-A with-O or-not non-

  • Processing action: The default is-print: Print display-ls: Display the details of each file like-ls-l,-ok commad \; Each operation requires the user's confirmation-exec Commad {} (referenced files found) does not require user confirmation (example: fin D./-perm-001-exec mv {} {}.new\;)

  • Special permissions:

  • SUID: When running a program, the owner of the corresponding process is the owner of the program file itself, not the initiator's

  • SGID: When running a program, the owning group of the corresponding process is the basic group of the program file itself, not the initiator's

  • Sticky: In a common directory, each user can create files, but only the files they create

  • chmod u+s,g+s,o+t File if the original X permission, the last one displayed as s otherwise display as S



This article is from the "stupid Bird first-FAI" blog, please be sure to keep this source http://benniaoxianhui.blog.51cto.com/10463960/1679202

Linux notes--vim Editor, combination conditions, file lookup, suid special permissions

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.