Linux 104 Training Module File Editing
This presentation will cover the following topics in vi Command mode and Insert mode Basic commands for file editing Cut copy paste Searching string
enables to insert text in file. vi abc.txt Command Mode : saving files, executing commands, moving cursor, pasting lines or words, and finding and replacing. Insert Mode : enables to insert text in file. vi starts in command mode and to come into insert mode type i. :w -- to save file anytime :wq -- most used to save data and quit :q! -- quit without saving :wq! -- to save change in file opened in read-only mode. yy -- equivalent to cut also called yank
:<line no> -- goto line no. x -- delete the char a -- add text after the cursor. i -- insert text at the cursor
Highlight a region by pressing "v" and moving the cursor. Cut/Copy/Paste Highlight a region by pressing "v" and moving the cursor. Use either x to cut or y to copy Use P to insert the text "before" the cursor, and p to put the text at the point after the cursor Searching for strings To search for a string in forward direction, while in command mode , hit / Followed by the search expression. To search a string in reverse direction, hit ?