Vi Editor Command Mode
Vi Editor Command Mode
systems used to create, edit, and view files. It’s a powerful tool for
editing configuration files, scripts, and general text. It operates in
two primary modes: command mode and insert mode.and total
eske pass 4 modes hote hai command mode,insert mode,execute
mode,read only mode
command mode is the default mode when you open a file. This
mode is used to navigate the file, delete or move text, search for
words, and execute various commands.
1. Navigation Commands:
1. h, j, k, l:
○ h: Move left (one character).
○ j: Move down (one line).
○ k: Move up (one line).
○ l: Move right (one character).
2. w and b:
○ w: Move to the beginning of the next word.
○ b: Move to the beginning of the previous word.
3. 0 and $:
○ 0: (this is zero)Move to the beginning of the current line.
○ $: (this is dollar)Move to the end of the current line.
4. G and gg:
○ G: (capital G) Go to the last line of the file.
○ gg: Go to the first line of the file.
5. Ctrl + f and Ctrl + b:
○ Ctrl + f: Scroll forward one screen.
○ Ctrl + b: Scroll backward one screen.
4. File Operations:
● :w: Save (write) the file.
● :q: Quit the editor.
● :wq: Save and quit.
● :q!: Quit without saving (force quit).
● :w [filename]: Save the file with a different name.
● :e [filename]: Open a new file within the same vi session.
5. Advanced Commands: