Title: Vi Commands - Correcting (replace, delete and undo)
Course: CIS 121: Linux/UNIX I: Fundamentals ~ For IGNITE Review > Section: Learning Modules

When in command mode (it doesn't hurt to hit the escape key more than once) you can use the x key to delete the current character. The big X key (or shift x) will delete the character left of the cursor. Also when in command mode, you can use the r key to replace one single character. (Source: Linux Fundamentals, Cobbaut, 148)

- x – Delete character at cursor position
- 6x – Delete 6 characters starting at cursor position
- X – Delete character before cursor
- 18X – Delete 18 characters before cursor
- dd – Delete current line
- 7dd – Delete seven lines starting with the current line
- r – Replace character
- rz – Replace character at cursor with a 'z'
- 5rz – Replace 5 characters starting at the cursor with 'z's
- R – Enter type-over mode – Only lasts to end of line, then you start a new line
- u – Undo last command
- U – Restore line to original content