Lesson 9: The Surgeon's Knife (Vim)
Every DevOps engineer must know how to edit files on a server. There is no "Notepad" on a remote server—you have to use Vim.
The Two Faces of Vim
Vim is special because it has Modes:
- Normal Mode: Where you navigate. You start here. (Press
Escto return). - Insert Mode: Where you actually type. (Press
ito enter).
How to Save & Exit
- Press
Esc. - Type
:wq(Write and Quit) and pressEnter. - To quit without saving, type
:q!.
booting...
Mission Objective
We have a file called config.txt with the line STATUS=INACTIVE. Use Vim to change it to STATUS=ACTIVE.
- Type
vi config.txt. - Move to the word
INACTIVE. - Press
ito insert. DeleteINACTIVEand typeACTIVE. - Press
Esc, then type:wqto save.