Basic vi editor commands for RHEL OS
Basic vi commands while in command mode
- To invoke vi editor type ‘vi’ <filename> on the command line.
- vi filename
| Input Command | Description |
| dd | Delete line |
| 3dd | Delete 3 lines |
| dw | Delete word |
| 4dw | Delete 4 words |
| ESC | Terminate insert mode |
| u | Undo last change |
| U | Undo all changes to entire line |
| h/j/k/l | Move cursor left/down/up/right |
| spacebar | Move cursor right one space |
| ctrl-d | Scroll down one half of a page |
| ctrl-d | Scroll down one half of a page |
| ctrl-u | Scroll up one half of a page |
| ctrl-f | Scroll forward one page |
| ctrl-b | Scroll back one page |
| gg | For going to top of file |
| shift+g | For bottom of file |
| /word | For searching the word in Entire File |
| yy | For copying |
| 3yy | will copy 3 lines |
| p | For pasting |
| x10 | delete (cut) 10 characters |
| : u | undo last command |
| :%s/apple/ball/g | It searches and replaces all the occurrence of word apple with ball in the entire file |
No comments:
Post a Comment