M👀ds of Vi✒️

Tharunravuri
2 min readMay 13, 2021

Hola! This blog contains few concepts that I learn while reading a book. Maybe it can help you too. Go ahead and take a look!

Any file can be edited using a text editor in Linux. However, the prominent text editors that widely use are Vim, Nano, and other graphical text editors like gedit, emacs etc.

Anyways the usage of graphical text editors is impossible when you are working in servers. So the only option is to go with either nano or vim.

Vim is used commonly and widely in all servers. So a piece of brief information on vim tool is more helpful.

Vim stands for “ Vi IMproved.” Vim editor can be accessed using the vi command.

Vim editor contains three modes to edit any file.

  1. Command mode — This is used to search for a pattern, copy, or paste the text. Use “ / ” for finding any pattern in the file. You can come back to command mode anytime by pressing the ESC key.
  2. Insert mode — Insert mode is used to insert the content inside the file. Press the “ i ” key to insert any content in the file.
  3. Line mode — Line mode is used to save or quit the file. Use “ : ” in the line mode.

:w — Writes (saves) the file.

:w! — Forces the file to be saved even if the write permission is not set. This only works on files you own.

:q — Quit. This will only work if there have not been any modifications to the file.

:q! — Quit without saving changes made to the file.

:wq! — Write and quit. After modifying a file this command ensures it gets saved and closes vi.

This is one of the commonly used commands in my work. But TBH I seriously don’t know about these modes until I read the Linux for Dummies book.

Clap and share with your friends. Meet you on the next blog!! 💌

--

--