To open o create new text file in vi enter
vi textfile
vi opens in a command mode. to enter input mode press i. To return to command mode press Esc
| Command | Description |
| i | input mode |
| :q! | quit |
| :wq! | save and quit |
| : | save file |
| dd | delete line |
| u | undo |
| o | start new line |
| /text | search text |
| gg | return to first line |
| :%s/text1/text2/ | search text1 and replace it with text2 for one instance |
| :%s/text1/text2/g | search text1 and replace it with text2 for all instance |
Page last modified on July 15, 2021, at 04:24 AM
Powered by
PmWiki