command to enter VI vi FileName: Opens or creates a new file and places the cursor at the beginning of the first VI N filename: Open the file and place the cursor at the beginning of the nth line VI filename: Open the file and place the cursor in the first row Vi/pattern FileName: Opens the file and places the cursor at the first string matching the pattern vi-r filename: A system crash occurred last time you were editing with VI, Filenamevi filename....filename: Open multiple files, Edit Move Cursor class command h: Move cursor left one character L: Cursor right one character space: Cursor moves right one character backspace: Cursor moves left one character K or ctrl p: Move cursor up line J or Ctrl N: Move cursor down line Enter : The cursor moves down a line w or w: The cursor moves right one word to the first B or B: The cursor moves left one word to the beginning E or e: The cursor moves one word to the end of the word: The cursor moves to the end of the sentence (: Cursor moves to the beginning of the sentence}: Cursor moves to the end of the paragraph. : Cursor down N-line n: Cursor up n line n$: Cursor moves to nth line end H: Cursor moves to top row of screen m: cursor moves to middle line of screen L: Cursor moves to screen line 0: (note is number 0) cursor moves to current line $: cursor moves to current end screen tumbling class command ctrl U: To file the first half screen Ctrl d: to the end of the file half a screen ctrl f: Flip a screen to the end of the file ctrl+b; one screen to the top of the file. NZ: Roll the row N to the screen, roll the current line to the top of the screen without specifying n . Insert text Class command i: Before the cursor I : At the beginning of the current line a: After the cursor A: At the end of the current row o: A new line below the current line O: New line above the current row R: replace the current character R: replace the current character and its following characters until the ESC key s: Start at the current cursor position, replace the specified number of characters with the input text Press ESC to jump to command mode, and then: :w Save the file without exiting Vi:w. File to save the modification to file without exiting vi:w! Force save, do not eject Vi:wq save file and exit vi:wq! Force save file and exit Viq: Do not save file, exit vi:q! Do not save the file, Force exit vi:e! Discard all changes, starting from the last save file and then edit , enter,ok! to enter VI command  VI FileName: Opens or creates a new file and places the cursor at the beginning of the first VI N filename: Open the file and place the cursor at the beginning of the nth line VI filename: Open the file and place the cursor on the first vi/pattern filename: Open file, and place the cursor at the first string matching the pattern vi-r filename: A system crash occurred in the last edit with VI, Recovery Filenamevi filename....filename: Open multiple files, edit in sequence www.2cto.com Move Cursor class command h: The cursor moves left one character L: The cursor moves right one character space: The cursor moves right one character backspace: The cursor moves left one character K or ctrl p: Move the cursor up a line J or ctrl n : The cursor moves down one line of ENTER: Move the cursor down a line w or w: The cursor moves right one word to the first B or B: The cursor moves left one word to the beginning E or e: The cursor moves one word to the end of the word: The cursor moves to the end of the sentence (: Cursor moves to the beginning of the sentence}: The cursor moves to the end of the paragraph. : Cursor down N-line n: Cursor up n line n$: Cursor moves to nth line end H: Cursor moves to the top line of screen m: cursor moves to middle line of screen L: Cursor moves to screen line 0: (note is number 0) cursor moves to current line $: cursor moves to current end www.2cto.com Screen tumbling Class command ctrl u: to file the first half screen Ctrl d: to the end of the file half a screen ctrl f: Flip a screen to the end of the file ctrl+b; move to the top of the file. NZ: Roll the line N to the front of the screen, and roll the current line to the top of the screen without specifying n . insert text Class command i: Before cursor I: At the beginning of the current line a: After the cursor A: At the end of the current row o: A new line below the current line o: A new line above the current line R: replace the current character R: replace the current character and its following characters until the ESC key s: Starts at the current cursor position. Replace the specified number of characters with the input text Save Command Press ESC to jump to command mode, and then: www.2cto.com :w Save the file but do not exit vi:w. File to save the modification to file. Do not exit vi:w! Force save, do not eject Vi:wq save file and exit vi:wq! Force save file and exit Viq: Do not save file, exit vi:q! Do not save the file, Force exit vi:e! Discard all changes from the lastSave file start and edit after, enter, ok!
Linux under the VI command to modify files and how to use the Save