Question: sudo vi /etc/hosts how to save?
Answer: Type vi /etc/hosts and press Enter. Without entering insert mode move to the character you want to change, press R, then press the key for the character you want to change to. To save and quit press Esc, :, w, q. Note: You may receive a warning indicating that the file is read only when you try to save and quit.