1. Edit x: Delete the character #x at the cursor: Delete the # characters that begin at the beginning of the cursor D: Delete command dd: Delete the entire line at the cursor #d: Delete the # line 2 the cursor in place. Last line mode start,end eg: 3,4 10,+9  .: Indicates the row of the cursor $: last line .,$-2: Current to 3rd line /pat1/,/pat2/ %: full-text traversal c: Change cc: #cc: R: Replace the character at the line where the cursor is y: (Yank) copy yy: #yy: p: (past) Paste copy delete entire row P: Paste below the line of the cursor p: Paste at the top of the line where the cursor is located copy Delete non-entire row p: Paste at the cursor location p: Paste at the front of the cursor 3. Revocation u:undo #u: ctrl+r revocation of the previous revocation 4. Turn screen ctrl+f : Turn one screen at the end of the file  CTRL+B&NBSP: Turn one screen to the head of the file ctrl+d : Turn half screen at the end of the file ctrl+u : Turn half screen enter k 5 to file header. Find  /KEYWORD&NBSP: Look down for the first string matching ?keyword : Find the first matching string up N       &NBSP: Find Next matching word down N    &NBSP: Look up the next matching word 6.vim visualization mode v: Select by the area of the cursor V: Select rectangular block 7. The definition of the window's properties set nu : Display line number set nonu : Turn off display set ai : Auto indent set noai : Turn off Auto indent     SET IC&NBSP: Ignore case set noic : Turn off Ignore case set sm (Show match) : Display the corresponding brackets set nosm : Turn off display     SYNTAX OFF&NBSP: Turn off syntax highlighting syntax on : Open Syntax highlighting set hlsearch : Search highlighting set nohlsearch : Turn off search highlighting 8.vim Profiles Global:/etc/vimrc Personal: ~/.VICRC 9. Find replacement  : Address delimitation s/Find mode/Replace with content/gi delimiter can be customized for s after the first character g:blobal i:ignore-case & : Used to refer to all the contents of the previous match in the content part of the replacement eg: .,[email protected]/etc/[email protected]/etc/[email protected] 1,[email protected]^[^#].*@#&@g (indicates lines preceded by # 1 to 30 lines not # # # # #) 10.bash file test monocular test         -E FILE&NBSP: Test file exists    -A FILE&NBSP: Test whether the file exists -f /path/to/ File: Test for normal file -d /path/to/file: Test for catalog file -b /path/to/somefile: Test file exists and is a device block file -c /path/to/somefile: Test file exists and is a character device file - h | -l /path/to/somefile test file exists and is a symbolic link file -p /path/to/somefile: Test file is storedIn and for pipe file -r /path/to/somefile: Test whether its valid users have read access to this file -s /path/to/somefile: Test file exists and is a socket file -s /path/to/somefile: Test file exists and is not empty -w -x Binocular Testing file1 -nt file2 test if file1 is newer than file2
Linux Fundamentals 13