How to save changes in vi?

QuestionsQuestions8 SkillsProYour First Linux LabAug, 23 2025
0250

To save changes in vi (or vim), follow these steps:

  1. Press Esc: This ensures you are in command mode.
  2. Type :w and press Enter: This command will save the changes you have made to the file.

If you want to save the changes and exit vi at the same time, you can use:

  • Type :wq and press Enter: This will save the changes and then quit the editor.

If you want to save the changes under a different filename, you can use:

  • Type :w newfilename and press Enter: Replace newfilename with the desired name for the file.

Remember to press Esc before typing the colon (:) to enter command mode.

0 Comments

no data
Be the first to share your comment!